Update app.py
Browse files
app.py
CHANGED
|
@@ -3,20 +3,20 @@ from groq import Groq
|
|
| 3 |
|
| 4 |
groq_api_key = os.getenv("GROQ_API_KEY")
|
| 5 |
|
| 6 |
-
#os.environ["GROQ_API_KEY"] = groq_api_key
|
| 7 |
|
| 8 |
-
|
| 9 |
-
api_key=groq_api_key,
|
| 10 |
-
)
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
| 3 |
|
| 4 |
groq_api_key = os.getenv("GROQ_API_KEY")
|
| 5 |
|
|
|
|
| 6 |
|
| 7 |
+
import gradio as gr
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
def chat_with_groq(message):
|
| 10 |
+
chat_completion = client.chat.completions.create(
|
| 11 |
+
messages=[
|
| 12 |
+
{
|
| 13 |
+
"role": "user",
|
| 14 |
+
"content": message,
|
| 15 |
+
}
|
| 16 |
+
],
|
| 17 |
+
model="llama-3.3-70b-versatile", # Using the same model as before
|
| 18 |
+
)
|
| 19 |
+
return chat_completion.choices[0].message.content
|
| 20 |
|
| 21 |
+
iface = gr.Interface(fn=chat_with_groq, inputs="textbox", outputs="textbox", title="Groq Chat with Llama 3.3 DDS")
|
| 22 |
+
iface.launch()
|