File size: 912 Bytes
06e8d70
 
 
537e134
 
 
06e8d70
 
 
 
537e134
 
06e8d70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
33
34
35
36
37
38
import os
from dotenv import load_dotenv
from groq import Groq
import gradio as gr


load_dotenv()
client = Groq(
    # This is the default and can be omitted
    api_key=os.environ.get("GROQ_API_KEY"),
)


def chat_with_groq(input_text,additional_info = None):
    chat_completion = client.chat.completions.create(
    messages=[
            {
                "role": "system",
                "content": "you are a healthy chef who is going to converse with user and provide recipes",
            },
            {
                "role": "user",
                "content": input_text,
            },
        ],
        model="llama3-70b-8192",
    )
    return chat_completion.choices[0].message.content
 

iface = gr.ChatInterface(
    fn=chat_with_groq,
    title="What do you feel like eating today?",
    description="Ask me what you'd like to eat!"
)

if __name__=="__main__":
    iface.launch(share=True)