geeksiddhant commited on
Commit
1d7f598
·
verified ·
1 Parent(s): 76ea468

Create app.py

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