MissieMcCown commited on
Commit
2f27609
·
verified ·
1 Parent(s): cbb60b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -9
app.py CHANGED
@@ -1,18 +1,26 @@
1
  import gradio as gr
2
 
3
- def check_gradio():
4
- return "Gradio is installed!"
 
 
 
 
 
5
 
6
- # Create a simple interface to test Gradio
7
  with gr.Blocks() as demo:
8
- gr.Markdown("### Gradio Installation Check")
9
- output_text = gr.Textbox()
 
 
 
 
 
 
10
 
11
- check_button = gr.Button("Check Gradio")
12
- check_button.click(check_gradio, outputs=output_text)
13
 
14
- # Launch Gradio interface
15
- demo.launch()
16
 
17
 
18
 
 
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
+ # Gradio Interface
12
  with gr.Blocks() as demo:
13
+ gr.Markdown("### Study Assistance Chatbot")
14
+ gr.Markdown("Welcome! Ask me anything related to your academic studies.")
15
+
16
+ user_input = gr.Textbox(label="Enter your question here:")
17
+ chatbot_output = gr.Textbox(label="Chatbot Response")
18
+ submit_button = gr.Button("Submit")
19
+
20
+ submit_button.click(chatbot_response, inputs=user_input, outputs=chatbot_output)
21
 
22
+ demo.launch(share=True) # Make the app public if you want others to access
 
23
 
 
 
24
 
25
 
26