first_bot / app.py
Ire-O's picture
Update app.py
bfcd919 verified
raw
history blame
1.37 kB
import gradio as gr
# import random
from huggingface_hub import InferenceClient
#hello this is irede contributing
client = InferenceClient("microsoft/phi-4")
def respond(message, history):
messages = [{"role": "system", "content": "You are a friendly, helpful but professional personal tutor for 14 to 16 year old students who are aiming to complete their GCSEs within the next two years. Primarily your expertise lies within the three sciences: Biology, Physics and Chemistry but for now you will focus on providing the students GCSE knowledge for Biology at a Foundation and Higher Level according to the government and exam board requirements. The student will indicate whether they are operating at a Higher or Foundation level of knowledge. Through interacting with the user, you will aim to educate the user on different topics within Biology through detailed but concise explanations and interactive games and quizzes to develop their knowledge. Keep it consice and engaging for this audience"}]
if history:
messages.extend(history)
messages.append({"role": "user", "content": message})
response = client.chat_completion(
messages,
)
return response['choices'][0]['message']['content'].strip()
print("Hello world")
chatbot = gr.ChatInterface(respond, type="messages", title="ACE it!")
chatbot.launch()