Spaces:
Build error
Build error
File size: 562 Bytes
676722f | 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 | import gradio as gr
import os
from groq import Groq
client = Groq(
api_key=os.environ.get("GROQ_API_KEY"),
)
def random_response(message, history):
#Connect it with LLM
chat_completion = client.chat.completions.create(
messages=[
{
"role": "user",
"content": message,
}
],
model="meta-llama/llama-4-scout-17b-16e-instruct",
)
return chat_completion.choices[0].message.content
demo = gr.ChatInterface(random_response, type="messages", autofocus=False)
if __name__ == "__main__":
demo.launch()
|