Spaces:
Running
Running
import random | |
import gradio as gr | |
from groq import Groq | |
import os | |
from dotenv import load_dotenv | |
load_dotenv() | |
groq = Groq(api_key=os.getenv("GROQ_API_KEY")) | |
def random_response(message, history): | |
return random.choice(["Yes", "No"]) | |
def chat_completion(message, history): | |
response = groq.chat.completions.create( | |
model="meta-llama/llama-4-scout-17b-16e-instruct", | |
messages=[{"role": "user", "content": message}], | |
) | |
return response.choices[0].message.content | |
demo = gr.ChatInterface(chat_completion, title="LLAMA 3.1", description="Ask the bot a question", theme="soft") | |
if __name__ == "__main__": | |
demo.launch() |