HealthyRecipe / app.py
Abhlash's picture
removed unused code
01b6b1e verified
raw
history blame contribute delete
912 Bytes
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)