studychatbot / app.py
MissieMcCown's picture
Update app.py
4c522a2 verified
raw
history blame
910 Bytes
import gradio as gr
# Enhanced chatbot response function
def chatbot_response(user_input):
if 'time management' in user_input.lower():
return "Time management is important! Here are a few tips: 1. Prioritize tasks. 2. Set deadlines. 3. Break tasks into smaller parts."
elif 'science' in user_input.lower():
return "Science is fascinating! What specific topic are you interested in? Physics, Chemistry, Biology?"
else:
return f"You said: {user_input}"
# Gradio interface setup
with gr.Blocks() as demo:
gr.Markdown("### Study Assistance Chatbot")
user_input = gr.Textbox(label="Enter your question here:", placeholder="Type your question...")
chatbot_output = gr.Textbox(label="Chatbot Response")
submit_button = gr.Button("Submit")
submit_button.click(chatbot_response, inputs=user_input, outputs=chatbot_output)
# Launch Gradio
demo.launch()