Spaces:
Sleeping
Sleeping
Update chatbot_ui.py
Browse files12243467891011121314151617181920212223242526272856789 unmodified lines18192021import gradio as gr # For building the chatbot UIimport random # For generating random responses
# Chatbot response function# Simplified chatbot response functiondef chatbot_response(user_input): # Ensure the input is in lowercase and stripped of extra spaces user_input = user_input.strip().lower()
# Define responses for specific queries if "hello" in user_input or "hi" in user_input: return "Hello! How can I help you with your studies today?"
# Handle time management query elif "time management" in user_input: return "Time management is key! Try creating a prioritized to-do list and setting specific study blocks."
# Handle study tips query elif "study tips" in user_input: tips = [ "Take regular breaks while studying to stay focused.", "Use active recall and spaced repetition for better retention.", "Set a specific goal for each study session." ] return random.choice(tips)
# If input doesn't match predefined queries else: return "I'm here to assist with general academic questions. Feel free to ask about study tips, time management, or anything else!" return "You said: " + user_input
# Gradio interface setupwith gr.Blocks() as demo:9 unmodified lines
# Launch the Gradio appdemo.launch()
chatbot_ui.py+3-25