demo-100x / app.py
geeksiddhant's picture
Update app.py
e300ea0 verified
raw
history blame contribute delete
No virus
833 Bytes
import os
import gradio as gr
from groq import Groq
client = Groq(
# This is the default and can be omitted
api_key=os.environ.get("GROQ_API_KEY"),
)
def chat_with_groq(user_input, additional_info=None): # Added additional_info parameter
chat_completion = client.chat.completions.create(
messages=[
{
"role": "system",
"content": "you are a helpful assistant."
},
{
"role": "user",
"content": user_input,
}
],
model="mixtral-8x7b-32768",
)
return chat_completion.choices[0].message.content
iface = gr.ChatInterface(
fn=chat_with_groq,
title="Groq Chatbot",
description="Ask anything to the Groq-powered chatbot."
)
if __name__ == "__main__":
iface.launch()