Spaces:
Sleeping
Sleeping
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) |