Spaces:
Sleeping
Sleeping
Update chatbot_ui.py
Browse files4 unmodified lines56788910115 unmodified lines17181920202122238 unmodified lines32333435353637383939404142434445464745464 unmodified linesdef chatbot_response(user_input): user_input = user_input.lower()
if user_input.strip() == "": # Show the welcome message for empty input if user_input.strip() == "": return "Welcome! How can I assist you with your studies today?"
if "time management" in user_input:5 unmodified lines "Use active recall and spaced repetition for better retention.", "Set a specific goal for each study session." ] return random.choice(tips) # Randomly pick a study tip return random.choice(tips)
elif "hello" in user_input or "hi" in user_input: return "Hello! How can I help you with your studies today?"8 unmodified lines with gr.Row(): with gr.Column(): user_input = gr.Textbox(label="Enter your question here:") user_input = gr.Textbox(label="Enter your question here:", placeholder="Type your question...") submit_button = gr.Button("Submit") with gr.Column(): chatbot_output = gr.Textbox(label="Chatbot Response", interactive=False, value="Welcome! How can I assist you with your studies today?") chatbot_output = gr.Textbox(label="Chatbot Response", interactive=False) # Trigger a welcome message on app launch demo.load(lambda: "Welcome! How can I assist you with your studies today?", outputs=chatbot_output) submit_button.click(chatbot_response, inputs=user_input, outputs=chatbot_output)
# Launch the Gradio appdemo.launch()
chatbot_ui.py+7-6