File size: 621 Bytes
251c339
536120d
251c339
536120d
19aa258
251c339
536120d
 
40ca28f
b766e57
b1e6d37
40ca28f
 
 
b1e6d37
 
 
 
 
 
 
 
 
 
536120d
b1e6d37
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
from groq import Groq
import gradio as gr


groq_api_key   = os.getenv("GROQ_API_KEY")




def chat_with_groq(message):
    client = Groq(
    api_key=groq_api_key,
)
    chat_completion = client.chat.completions.create(
        messages=[
            {
                "role": "user",
                "content": message,
            }
        ],
        model="llama-3.3-70b-versatile", # Using the same model as before
    )
    return chat_completion.choices[0].message.content

iface = gr.Interface(fn=chat_with_groq, inputs="textbox", outputs="textbox", title="Groq Chat with Llama 3.3 DDS")
iface.launch()