File size: 1,368 Bytes
c5e8e78
6576a84
 
 
bfcd919
 
6576a84
c5e8e78
2abcde6
68cf03d
6576a84
 
 
 
 
 
 
 
 
 
 
c5e8e78
b35e180
 
30d6b1e
c5e8e78
 
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
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()