Spaces:
Sleeping
Sleeping
Update app.py
Browse files343 unmodified lines344345346347348349350308 unmodified lines65966066166266366466566666766821 unmodified lines69069169269369469569669769869921 unmodified lines72172272372472572672711 unmodified lines73974074174274374474574674774810 unmodified lines759760761762763764765766767343 unmodified lineswith 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: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 dropdowndef handle_login(username, password):if login_user(username, password):user_session.value = usernameprev_choices = get_previous_patients()# Return 27 outputs now: existing 20 plus 7 more for sessions and booking tabs.return (f"Welcome, {username}!", # login_outputgr.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))else:# On failure, clear those fields as well.return ("Invalid credentials.", # login_outputgr.update(), # main_panel21 unmodified lines"", # patient_name_appt"", # appointment_date"", # appointment_time"" # reason)11 unmodified linestherapy_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])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))logout_button.click(handle_logout,outputs=[343 unmodified lines344345346347348349350308 unmodified lines65966066166266366466566666766821 unmodified lines69069169269369469569669769869921 unmodified lines72172272372472572672772811 unmodified lines74074174274374474574674774874975075110 unmodified lines762763764765766767768769770771772343 unmodified lineswith gr.Row(elem_id="header") as header_row:with gr.Column(scale=8):gr.Markdown("## Mental Health Chatbot")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 dropdowndef handle_login(username, password):prev_choices = []if login_user(username, password):user_session.value = usernameprev_choices = get_previous_patients()return (f"Welcome, {username}!", # login_outputgr.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)gr.update(visible=True) # profile_container: show profile icon now)else:return ("Invalid credentials.", # login_outputgr.update(), # main_panel21 unmodified lines"", # patient_name_appt"", # appointment_date"", # appointment_time"", # reasongr.update(visible=False) # profile_container: hide profile icon on failure)11 unmodified linestherapy_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,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)gr.update(visible=False) # profile_container: hide profile icon)logout_button.click(handle_logout,outputs=[
app.py+12-7