ryanpereira commited on
Commit
676722f
·
verified ·
1 Parent(s): 8e4ab37

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ def random_response(message, history):
9
+ #Connect it with LLM
10
+ chat_completion = client.chat.completions.create(
11
+ messages=[
12
+ {
13
+ "role": "user",
14
+ "content": message,
15
+ }
16
+ ],
17
+ model="meta-llama/llama-4-scout-17b-16e-instruct",
18
+ )
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
+
28
+