Gradio / app.py
HashvardhanCn1's picture
Update app.py
1d1c863 verified
raw
history blame contribute delete
623 Bytes
import os
os.environ['GROQ_API_KEY'] = "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"
from groq import Groq
client = Groq()
def chatbot(prompt):
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content":prompt,
}
],
model="llama3-8b-8192",
stream=False,
)
return chat_completion.choices[0].message.content
import gradio as gr
gradio_app = gr.Interface(
chatbot,
inputs=['text'],
outputs=['text'],
title="Harsh's Chatbot",
)
if __name__ == "__main__":
gradio_app.launch(debug=True)