Spaces:
Sleeping
Sleeping
Update app.py
Browse files343 unmodified lines344345346347347348349350308 unmodified lines65966066166266366466566566666766821 unmodified lines69069169269369369469569669669769869921 unmodified lines72172272372472472572672772811 unmodified lines74074174274274374474574674774874975075110 unmodified lines762763764762765766767768769770771772343 unmodified lines with gr.Row(elem_id="header") as header_row: with gr.Column(scale=8): gr.Markdown("## Mental Health Chatbot") with gr.Column(scale=4) as profile_container: with gr.Column(visible=False, elem_id="profile_container") as profile_container: profile_button = gr.Button("👤", elem_id="profile_button", variant="secondary") with gr.Column(visible=False, elem_id="profile_info_box") as profile_info_box: profile_info = gr.HTML()308 unmodified lines
# Handle login: update previous patients dropdown def handle_login(username, password): prev_choices = [] if login_user(username, password): user_session.value = username prev_choices = get_previous_patients() # Return 27 outputs now: existing 20 plus 7 more for sessions and booking tabs. return ( f"Welcome, {username}!", # login_output gr.update(visible=True), # main_panel21 unmodified lines "", # patient_name_appt (Booking tab field) "", # appointment_date (Booking tab field) "", # appointment_time (Booking tab field) "" # reason (Booking tab field) "", # reason (Booking tab field) gr.update(visible=True) # profile_container: show profile icon now ) else: # On failure, clear those fields as well. return ( "Invalid credentials.", # login_output gr.update(), # main_panel21 unmodified lines "", # patient_name_appt "", # appointment_date "", # appointment_time "" # reason "", # reason gr.update(visible=False) # profile_container: hide profile icon on failure )
11 unmodified lines therapy_textbox, therapy_conf_html, summary_textbox, explanation_textbox, generate_report_btn, report_download, session_data_state, search_name, search_date, booking_output, patient_name_appt, appointment_date, appointment_time, reason search_name, search_date, booking_output, patient_name_appt, appointment_date, appointment_time, reason, profile_container # new output for profile container ] )
def handle_logout(): user_session.value = "" return (10 unmodified lines "", # Clear new_username textbox (register page) "", # Clear new_password textbox (register page) "", # Clear full_name textbox (register page) "" # Clear email textbox (register page) "", # Clear email textbox (register page) gr.update(visible=False) # profile_container: hide profile icon )
logout_button.click( handle_logout, outputs=[app.py+12-7