dek924 commited on
Commit
10b309c
·
1 Parent(s): 072dde6

feat: requirement update & optout share option

Browse files
Files changed (2) hide show
  1. app.py +8 -4
  2. requirements.txt +1 -1
app.py CHANGED
@@ -313,6 +313,7 @@ def start_manual(profile_mode: str, agent, sim_config: dict):
313
  gr.update(visible=True), gr.update(visible=False), gr.update(visible=False),
314
  )
315
 
 
316
  patient = sim_config["patient"]
317
  profile_html = (
318
  build_profile_html(patient)
@@ -352,7 +353,7 @@ def back_to_setup_from_chat(agent):
352
  if agent is not None:
353
  agent.reset_history(verbose=False)
354
  return (
355
- [], # clear chat
356
  "", # clear profile html
357
  None, # clear patient_agent_state
358
  None, # clear sim_config_state
@@ -444,9 +445,11 @@ def start_auto(agent, sim_config: dict):
444
  yield chat_history, gr.update(visible=False), gr.update(visible=True), gr.update(visible=False)
445
 
446
 
447
- def back_to_setup_from_auto():
 
 
448
  return (
449
- [], # clear auto chatbot
450
  None, # clear patient_agent_state
451
  None, # clear sim_config_state
452
  gr.update(visible=True), # show setup_section
@@ -679,6 +682,7 @@ with gr.Blocks(title="PatientSim", theme=gr.themes.Soft(), css=CUSTOM_CSS) as de
679
  )
680
  back_from_auto_btn.click(
681
  fn=back_to_setup_from_auto,
 
682
  outputs=[auto_chatbot, patient_agent_state, sim_config_state, setup_section, mode_section, auto_section, chat_section],
683
  )
684
 
@@ -714,4 +718,4 @@ with gr.Blocks(title="PatientSim", theme=gr.themes.Soft(), css=CUSTOM_CSS) as de
714
 
715
 
716
  if __name__ == "__main__":
717
- demo.launch(share=True)
 
313
  gr.update(visible=True), gr.update(visible=False), gr.update(visible=False),
314
  )
315
 
316
+ agent.reset_history(verbose=False)
317
  patient = sim_config["patient"]
318
  profile_html = (
319
  build_profile_html(patient)
 
353
  if agent is not None:
354
  agent.reset_history(verbose=False)
355
  return (
356
+ gr.update(), # keep chat log
357
  "", # clear profile html
358
  None, # clear patient_agent_state
359
  None, # clear sim_config_state
 
445
  yield chat_history, gr.update(visible=False), gr.update(visible=True), gr.update(visible=False)
446
 
447
 
448
+ def back_to_setup_from_auto(agent):
449
+ if agent is not None:
450
+ agent.reset_history(verbose=False)
451
  return (
452
+ gr.update(), # keep auto chatbot log
453
  None, # clear patient_agent_state
454
  None, # clear sim_config_state
455
  gr.update(visible=True), # show setup_section
 
682
  )
683
  back_from_auto_btn.click(
684
  fn=back_to_setup_from_auto,
685
+ inputs=[patient_agent_state],
686
  outputs=[auto_chatbot, patient_agent_state, sim_config_state, setup_section, mode_section, auto_section, chat_section],
687
  )
688
 
 
718
 
719
 
720
  if __name__ == "__main__":
721
+ demo.launch()
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- gradio
2
  numpy
3
  google-genai>=1.19.0
4
  openai>=1.0.0
 
1
+ gradio==6.10.0
2
  numpy
3
  google-genai>=1.19.0
4
  openai>=1.0.0