umair894 commited on
Commit
809f54b
·
verified ·
1 Parent(s): 9b5d9ff

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from groq import Groq
3
+
4
+ client = Groq(api_key = key)
5
+
6
+
7
+ def echo(message, history):
8
+ stream = client.chat.completions.create(
9
+
10
+ messages=[
11
+ {
12
+ "role": "system",
13
+ "content": "you are a helpful assistant."
14
+ },
15
+ # Set a user message for the assistant to respond to.
16
+ {
17
+ "role": "user",
18
+ "content": message,
19
+ }
20
+ ],
21
+
22
+ model="llama3-8b-8192",
23
+
24
+ temperature=0.5,
25
+ max_tokens=1024,
26
+ top_p=1,
27
+
28
+ stop=None,
29
+
30
+ stream=False,
31
+ )
32
+
33
+ return stream.choices[0].message.content
34
+ demo = gr.ChatInterface(fn=echo, title="First Bot")
35
+ demo.launch()