decodingdatascience commited on
Commit
b1e6d37
·
verified ·
1 Parent(s): 19aa258

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
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
- client = Groq(
9
- api_key=groq_api_key,
10
- )
11
 
12
- chat_completion = client.chat.completions.create(
13
- messages=[
14
- {
15
- "role": "user",
16
- "content": "Explain the importance of fast language models",
17
- }
18
- ],
19
- model="llama-3.3-70b-versatile",
20
- )
 
 
21
 
22
- print(chat_completion.choices[0].message.content)
 
 
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()