Spaces:
Sleeping
Sleeping
File size: 768 Bytes
9781a78 42d9a74 60ecef5 9781a78 60ecef5 42d9a74 a4f5e47 9781a78 42d9a74 2e3866f 42d9a74 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
from groq import Groq
import os
groq_key = os.getenv('groq_key')
client = Groq(
api_key= groq_key #os.environ.get("GROQ_API_KEY"),
)
def chat(message, history):
chat_completion = client.chat.completions.create(
messages=[
{
"role": "system",
"content": "you are an MLOPs expert and AI Engineer",
},
{
"role": "user",
"content": message,
}
],
model="llama-3.1-8b-instant",
temperature = 0.5,
max_tokens = 256,
stop = None,
stream = False,
top_p = 1,
)
return chat_completion.choices[0].message.content
demo = gr.ChatInterface(fn=chat, title="Open Source chatbot")
demo.launch(debug = True) |