MissieMcCown commited on
Commit
69f9ac0
·
verified ·
1 Parent(s): df9ca5d

Upload chatbot_ui.py

Browse files
Files changed (1) hide show
  1. chatbot_ui.py +27 -0
chatbot_ui.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def chatbot_response(user_input):
4
+ if user_input.lower() in ["hello", "hi"]:
5
+ return "Hello! How can I help you with your studies today?"
6
+ elif "supervised learning" in user_input.lower():
7
+ return "Supervised learning is a machine learning approach where models are trained using labeled data."
8
+ else:
9
+ return "I'm here to assist you with your academic questions. Please ask me anything!"
10
+
11
+ with gr.Blocks() as demo:
12
+ gr.Markdown("# Study Assistance Chatbot")
13
+ gr.Markdown("Welcome! Ask me anything related to your academic studies.")
14
+
15
+ with gr.Row():
16
+ with gr.Column():
17
+ user_input = gr.Textbox(label="Enter your question here:")
18
+ submit_button = gr.Button("Submit")
19
+
20
+ with gr.Column():
21
+ chatbot_output = gr.Textbox(label="Chatbot Response", interactive=False)
22
+
23
+ submit_button.click(chatbot_response, inputs=user_input, outputs=chatbot_output)
24
+
25
+ demo.launch()
26
+
27
+