ChatBot-UI / app.py
adriiita's picture
Create app.py
5210630 verified
raw
history blame
864 Bytes
import os
import gradio as gr
from groq import Groq
client = Groq(
api_key=os.environ.get("GROQ_API_KEY"),
)
def chat_with_groq(user_input, additional_context=None):
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": user_input,
}
],
model="llama-3.1-8b-instant",
)
return chat_completion.choices[0].message.content
demo = gr.ChatInterface(fn=chat_with_groq,
chatbot=gr.Chatbot(height=250),
textbox=gr.Textbox(placeholder="Ask me any question", scale=6),
title="Hey NOPE",
theme="Monochrome",
description="Welcome to the world of NOPE",
examples=["Need some content Idea", "Generate some Thumbnail Text"],
retry_btn=None,
undo_btn="Delete Previous",
clear_btn="Clear",)
if __name__ == "__main__":
demo.launch()