File size: 1,232 Bytes
a8e7c75
b26fbd2
8ae3903
 
 
 
 
 
 
 
 
 
b26fbd2
b760005
b26fbd2
b760005
8ae3903
b760005
 
 
 
8ae3903
b760005
 
8ae3903
b760005
 
 
7bd1bb8
a8e7c75
82048a4
cbb60b6
a8e7c75
d20e712
4c522a2
9dce57b
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
29
30
31
32
33
34
35
36
37
import gradio as gr

def chatbot_response(user_input):
    # Handle different questions
    if user_input.lower() in ['hello', 'hi', 'hey']:
        return "Hi there! How can I help you with your studies today?"
    elif 'supervised learning' in user_input.lower():
        return "Supervised learning is a machine learning approach where models are trained using labeled data."
    elif 'help' in user_input.lower():
        return "I'm here to assist with academic questions. Please specify what you'd like help with."
    else:
        return "I'm here to assist with academic questions. Please specify if you'd like help with any specific subject or topic."

with gr.Blocks() as demo:
    gr.Markdown("# Study Assistance Chatbot")
    gr.Markdown("Welcome! Ask me anything related to your academic studies.")

    with gr.Row():
        with gr.Column():
            user_input = gr.Textbox(label="Enter your question here:")
            submit_button = gr.Button("Submit")

        with gr.Column():
            chatbot_output = gr.Textbox(label="Chatbot Response", interactive=False)

    submit_button.click(chatbot_response, inputs=user_input, outputs=chatbot_output)

demo.launch()
from datasets import load_dataset