Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,26 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
#
|
| 7 |
with gr.Blocks() as demo:
|
| 8 |
-
gr.Markdown("###
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 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 |
|