raz-135's picture
Update app.py
f292299 verified
raw
history blame contribute delete
968 Bytes
import gradio as gr
from groq import Groq
import os
client = Groq(api_key = os.getenv('GROQ_API_KEY'))
def chat(message, history):
chat_completion = client.chat.completions.create(
#
# Required parameters
#
messages=[
{
"role": "system",
"content": "you are a career assistant. You provide career paths to the students based on their interests and expertise in some subjects."
},
# Set a user message for the assistant to respond to.
{
"role": "user",
"content": message,
}
],
# The language model which will generate the completion.
model="llama3-8b-8192",
temperature=0.5,
max_tokens=256,
top_p=1,
stop=None,
stream=False,
)
return chat_completion.choices[0].message.content
demo = gr.ChatInterface(
fn=chat,
title="Career Assistant"
)
demo.launch(debug= True)