Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -203,7 +203,7 @@ def show_emergency_resources():
|
|
203 |
def get_available_times(therapist):
|
204 |
if therapist and therapist in therapists:
|
205 |
return therapists[therapist]["times"], f"Available times for {therapist} loaded."
|
206 |
-
return [], "Please select a therapist."
|
207 |
|
208 |
# Create MIME message for Gmail API
|
209 |
def create_message(to, subject, message_text):
|
@@ -286,7 +286,7 @@ Mental Health Chatbot
|
|
286 |
def schedule_appointment(therapist, time_slot, date, user_email, state):
|
287 |
if not therapist or therapist not in therapists:
|
288 |
return "Please select a therapist.", state
|
289 |
-
if not time_slot:
|
290 |
return "Please select a time slot.", state
|
291 |
if not date:
|
292 |
return "Please select a date.", state
|
@@ -390,9 +390,10 @@ with gr.Blocks(title="Mental Health Support Chatbot") as demo:
|
|
390 |
placeholder="Enter date (YYYY-MM-DD)"
|
391 |
)
|
392 |
time_slot = gr.Dropdown(
|
393 |
-
choices=[],
|
394 |
label="Appointment Time",
|
395 |
-
interactive=True
|
|
|
396 |
)
|
397 |
user_email = gr.Textbox(
|
398 |
label="Your Email",
|
|
|
203 |
def get_available_times(therapist):
|
204 |
if therapist and therapist in therapists:
|
205 |
return therapists[therapist]["times"], f"Available times for {therapist} loaded."
|
206 |
+
return ["Select time"], "Please select a therapist."
|
207 |
|
208 |
# Create MIME message for Gmail API
|
209 |
def create_message(to, subject, message_text):
|
|
|
286 |
def schedule_appointment(therapist, time_slot, date, user_email, state):
|
287 |
if not therapist or therapist not in therapists:
|
288 |
return "Please select a therapist.", state
|
289 |
+
if not time_slot or time_slot == "Select time":
|
290 |
return "Please select a time slot.", state
|
291 |
if not date:
|
292 |
return "Please select a date.", state
|
|
|
390 |
placeholder="Enter date (YYYY-MM-DD)"
|
391 |
)
|
392 |
time_slot = gr.Dropdown(
|
393 |
+
choices=["Select time"],
|
394 |
label="Appointment Time",
|
395 |
+
interactive=True,
|
396 |
+
allow_custom_value=True
|
397 |
)
|
398 |
user_email = gr.Textbox(
|
399 |
label="Your Email",
|