Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,14 @@
|
|
| 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
|
| 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 |
-
|
| 17 |
-
|
| 18 |
-
|
| 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 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
def chatbot_response(user_input):
|
| 4 |
+
# Handle basic greeting
|
| 5 |
if user_input.lower() in ["hello", "hi"]:
|
| 6 |
+
return "Hello! How can I assist you today?"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
# Add more conditions for different queries here
|
| 9 |
+
elif "supervised learning" in user_input.lower():
|
| 10 |
+
return "Supervised learning is a machine learning approach
|
|
|
|
|
|
|
| 11 |
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
|