QIDNLF commited on
Commit
8ee600c
Β·
verified Β·
1 Parent(s): 9fe8d1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -5
app.py CHANGED
@@ -72,6 +72,16 @@ def refresh_registry_data():
72
  def on_load():
73
  return gr.Dropdown(choices=refresh_registry_data())
74
 
 
 
 
 
 
 
 
 
 
 
75
  def update_category_dd(standard, version):
76
  print("DEBUG category:", standard, version, flush=True)
77
 
@@ -483,30 +493,35 @@ with gr.Blocks() as demo:
483
 
484
  demo.load(on_load, None, base_standard)
485
 
486
-
487
  base_standard.change(
488
  update_version_dd,
489
  base_standard,
490
  base_version
491
  )
492
 
493
-
494
  base_version.change(
495
  update_category_dd,
496
  [base_standard, base_version],
497
  base_category
498
  )
499
 
500
-
501
  base_version.change(
502
  update_comp_standard,
503
  [base_standard, base_version],
504
  comp_standard
505
  )
506
 
 
 
 
 
 
 
507
 
508
- comp_standard.change(update_version_dd, comp_standard, comp_version)
509
-
510
  comp_version.change(
511
  update_category_dd,
512
  [comp_standard, comp_version],
 
72
  def on_load():
73
  return gr.Dropdown(choices=refresh_registry_data())
74
 
75
+ def update_version_dd(standard):
76
+ if not standard:
77
+ return gr.Dropdown(choices=[])
78
+
79
+ versions = sorted(set(
80
+ d["version"] for d in db_registry if d["standard"] == standard
81
+ ))
82
+
83
+ return gr.Dropdown(choices=versions)
84
+
85
  def update_category_dd(standard, version):
86
  print("DEBUG category:", standard, version, flush=True)
87
 
 
493
 
494
  demo.load(on_load, None, base_standard)
495
 
496
+ # βœ… base β†’ version
497
  base_standard.change(
498
  update_version_dd,
499
  base_standard,
500
  base_version
501
  )
502
 
503
+ # βœ… base β†’ category
504
  base_version.change(
505
  update_category_dd,
506
  [base_standard, base_version],
507
  base_category
508
  )
509
 
510
+ # βœ… base β†’ comp_standard (λ§€ν•‘)
511
  base_version.change(
512
  update_comp_standard,
513
  [base_standard, base_version],
514
  comp_standard
515
  )
516
 
517
+ # βœ… comp β†’ version
518
+ comp_standard.change(
519
+ update_version_dd,
520
+ comp_standard,
521
+ comp_version
522
+ )
523
 
524
+ # βœ… comp β†’ category
 
525
  comp_version.change(
526
  update_category_dd,
527
  [comp_standard, comp_version],