MissieMcCown commited on
Commit
ceda1d7
·
verified ·
1 Parent(s): 54fea08

Update chatbot_ui.py

Browse files
Files changed (1) hide show
  1. chatbot_ui.py +3 -25
chatbot_ui.py CHANGED
@@ -1,31 +1,8 @@
1
  import gradio as gr # For building the chatbot UI
2
- import random # For generating random responses
3
 
4
- # Chatbot response function
5
  def chatbot_response(user_input):
6
- # Ensure the input is in lowercase and stripped of extra spaces
7
- user_input = user_input.strip().lower()
8
-
9
- # Define responses for specific queries
10
- if "hello" in user_input or "hi" in user_input:
11
- return "Hello! How can I help you with your studies today?"
12
-
13
- # Handle time management query
14
- elif "time management" in user_input:
15
- return "Time management is key! Try creating a prioritized to-do list and setting specific study blocks."
16
-
17
- # Handle study tips query
18
- elif "study tips" in user_input:
19
- tips = [
20
- "Take regular breaks while studying to stay focused.",
21
- "Use active recall and spaced repetition for better retention.",
22
- "Set a specific goal for each study session."
23
- ]
24
- return random.choice(tips)
25
-
26
- # If input doesn't match predefined queries
27
- else:
28
- return "I'm here to assist with general academic questions. Feel free to ask about study tips, time management, or anything else!"
29
 
30
  # Gradio interface setup
31
  with gr.Blocks() as demo:
@@ -41,3 +18,4 @@ with gr.Blocks() as demo:
41
 
42
  # Launch the Gradio app
43
  demo.launch()
 
 
1
  import gradio as gr # For building the chatbot UI
 
2
 
3
+ # Simplified chatbot response function
4
  def chatbot_response(user_input):
5
+ return "You said: " + user_input
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  # Gradio interface setup
8
  with gr.Blocks() as demo:
 
18
 
19
  # Launch the Gradio app
20
  demo.launch()
21
+