Spaces:
Running
Running
Commit
•
3319f43
1
Parent(s):
cdc64ca
Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,10 @@ import gradio as gr
|
|
5 |
client = Groq(api_key = os.environ.get("GROQ_API_KEY"), )
|
6 |
|
7 |
system_prompt = {
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
}
|
12 |
|
13 |
async def chat_groq(message, history):
|
14 |
|
@@ -22,7 +22,7 @@ async def chat_groq(message, history):
|
|
22 |
|
23 |
response_content = ''
|
24 |
|
25 |
-
stream = client.
|
26 |
model="llama3-8b-8192",
|
27 |
messages=messages,
|
28 |
max_tokens=1024,
|
@@ -37,11 +37,11 @@ async def chat_groq(message, history):
|
|
37 |
yield response_content
|
38 |
|
39 |
with gr. Blocks(theme=gr.themes.Monochrome(), fill_height=True) as demo:
|
40 |
-
gr.ChatInterface(
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
demo.queue()
|
47 |
demo.launch()
|
|
|
5 |
client = Groq(api_key = os.environ.get("GROQ_API_KEY"), )
|
6 |
|
7 |
system_prompt = {
|
8 |
+
"role": "system",
|
9 |
+
"content":
|
10 |
+
"You are a useful assistant. You reply with efficient answers. "
|
11 |
+
}
|
12 |
|
13 |
async def chat_groq(message, history):
|
14 |
|
|
|
22 |
|
23 |
response_content = ''
|
24 |
|
25 |
+
stream = client.chat.completions.create(
|
26 |
model="llama3-8b-8192",
|
27 |
messages=messages,
|
28 |
max_tokens=1024,
|
|
|
37 |
yield response_content
|
38 |
|
39 |
with gr. Blocks(theme=gr.themes.Monochrome(), fill_height=True) as demo:
|
40 |
+
gr.ChatInterface(chat_groq,
|
41 |
+
clear_btn=None,
|
42 |
+
undo_btn=None,
|
43 |
+
retry_btn=None,
|
44 |
+
)
|
45 |
|
46 |
demo.queue()
|
47 |
demo.launch()
|