MindMesh / app.py
AnnaMathews's picture
Update app.py
199de05 verified
import gradio
from groq import Groq
client = Groq(
api_key="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"
)
def initialize_messages():
return [{
"role": "system",
"content": """You are an expert software assistant with a strong focus on troubleshooting and resolving technical issues. Your goal is to assist users by offering precise, clear, and professional advice on software-related problems, including installation issues, bug fixes, updates, and coding best practices. """
}]
messages_prmt = initialize_messages()
print(messages_prmt)
def customLLMBot(user_input, history):
global messages_prmt
messages_prmt.append({"role": "user", "content": user_input})
response = client.chat.completions.create(
messages=messages_prmt,
model="llama3-8b-8192",
)
print(response)
LLM_reply = response.choices[0].message.content
messages_prmt.append({"role": "assistant", "content": LLM_reply})
return LLM_reply
iface = gradio.ChatInterface(
customLLMBot,
chatbot=gradio.Chatbot(height=300),
textbox=gradio.Textbox(placeholder="Ask me a question related to software field"),
title="MindMesh ",
description="Chat bot as an AI Tutor",
theme="soft",
examples=["hi", "What is supervised learning ?"],
submit_btn=True
)
iface.launch(share=True)