GovindRoy commited on
Commit
96c8b7d
·
verified ·
1 Parent(s): d6ecaf4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+
4
+ from groq import Groq
5
+
6
+ # Initialize the Groq client
7
+ client = Groq(
8
+ api_key=os.environ.get("GROQ_API_KEY"),
9
+ )
10
+
11
+ def random_response(message, history):
12
+
13
+ chat_completion = client.chat.completions.create(
14
+ messages=[
15
+ {
16
+ "role": "user",
17
+ "content": message,
18
+ }
19
+ ],
20
+ model="meta-llama/llama-4-maverick-17b-128e-instruct",
21
+ )
22
+ return chat_completion.choices[0].message.content
23
+
24
+ print("Starting Gradio application...")
25
+ demo = gr.ChatInterface(random_response, type="messages", autofocus=False)
26
+
27
+ if __name__ == "__main__":
28
+ print("Launching Gradio interface...")
29
+ demo.launch(share=True)