songs1 commited on
Commit
e9ef774
·
1 Parent(s): 10b55c8

load default filter

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -424,6 +424,10 @@ def get_base_value(value):
424
  return value
425
 
426
 
 
 
 
 
427
  # Tab selection helper
428
  def set_active_tab(selected_tab):
429
  visibles = [gr.update(visible=(tab == selected_tab)) for tab in TAB_NAMES]
@@ -515,7 +519,7 @@ with gr.Blocks(css_paths="style.css") as demo:
515
  with gr.Column(scale=4):
516
  json_output = gr.Code(
517
  label="Cohort Filter JSON",
518
- value=json.dumps({"op": "and", "content": []}, indent=4),
519
  language="json",
520
  interactive=False,
521
  show_label=True,
@@ -622,14 +626,6 @@ with gr.Blocks(css_paths="style.css") as demo:
622
  # api_name=False,
623
  )
624
 
625
- # Load initial counts on startup
626
- # demo.load(
627
- # fn=update_cards_with_counts,
628
- # inputs=[gr.State("")] + filter_cards,
629
- # outputs=filter_cards + [case_counter],
630
- # api_name=False,
631
- # )
632
-
633
  # Update checkboxes on filter generation
634
  # Also update JSON based on checkboxes
635
  # - relying on checkbox update to do this fires multiple times
@@ -699,5 +695,13 @@ with gr.Blocks(css_paths="style.css") as demo:
699
 
700
  # gr.api(generate_filter, api_name="generate_filter")
701
 
 
 
 
 
 
 
 
 
702
  if __name__ == "__main__":
703
  demo.launch(ssr_mode=False)
 
424
  return value
425
 
426
 
427
+ def load_default_filter():
428
+ return json.dumps({"op": "and", "content": []}, indent=4)
429
+
430
+
431
  # Tab selection helper
432
  def set_active_tab(selected_tab):
433
  visibles = [gr.update(visible=(tab == selected_tab)) for tab in TAB_NAMES]
 
519
  with gr.Column(scale=4):
520
  json_output = gr.Code(
521
  label="Cohort Filter JSON",
522
+ # value=json.dumps({"op": "and", "content": []}, indent=4),
523
  language="json",
524
  interactive=False,
525
  show_label=True,
 
626
  # api_name=False,
627
  )
628
 
 
 
 
 
 
 
 
 
629
  # Update checkboxes on filter generation
630
  # Also update JSON based on checkboxes
631
  # - relying on checkbox update to do this fires multiple times
 
695
 
696
  # gr.api(generate_filter, api_name="generate_filter")
697
 
698
+ # Load initial counts on startup
699
+ demo.load(
700
+ fn=load_default_filter,
701
+ inputs=None,
702
+ outputs=json_output,
703
+ api_name=False,
704
+ )
705
+
706
  if __name__ == "__main__":
707
  demo.launch(ssr_mode=False)