wenjiao commited on
Commit
fe37605
1 Parent(s): 4a0f379

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -313,6 +313,10 @@ def select(df, data: gr.SelectData):
313
  print('selected_values', selected_values, selected_indices)
314
  return gr.CheckboxGroup(list(selected_values.keys()))
315
 
 
 
 
 
316
  def generate_spider_chart(df, selected_keys):
317
  global selected_values
318
  print('generate_spider_chart', selected_values, selected_keys)
@@ -425,10 +429,10 @@ with demo:
425
  filter_columns_groupDtype = gr.Dropdown(choices=[i.value.name for i in GroupDtype], label="Group Size", multiselect=False, value="All", interactive=True,)
426
 
427
  with gr.Row():
428
- with gr.Column(scale=5):
429
- model_comparison = gr.CheckboxGroup(label="Accuracy Comparison on Selected Models", choices=list(selected_values.keys()), value=[], interactive=True, elem_id="model_comparison")
430
  with gr.Column(scale=1):
431
- spider_btn = gr.Button("Spider Chart Generation")
432
 
433
 
434
  leaderboard_table = gr.components.Dataframe(
@@ -451,6 +455,7 @@ with demo:
451
  leaderboard_table.select(select, leaderboard_table, model_comparison)
452
  spider_btn.click(generate_spider_chart, [leaderboard_table, model_comparison], map)
453
  spider_btn.click(lambda: Modal(visible=True), None, modal)
 
454
 
455
  # Dummy leaderboard for handling the case when the user uses backspace key
456
  hidden_leaderboard_table_for_search = gr.components.Dataframe(
 
313
  print('selected_values', selected_values, selected_indices)
314
  return gr.CheckboxGroup(list(selected_values.keys()))
315
 
316
+ def init_comparison_data():
317
+ global selected_values
318
+ return gr.CheckboxGroup(choices=list(selected_values.keys()), value=list(selected_values.keys()))
319
+
320
  def generate_spider_chart(df, selected_keys):
321
  global selected_values
322
  print('generate_spider_chart', selected_values, selected_keys)
 
429
  filter_columns_groupDtype = gr.Dropdown(choices=[i.value.name for i in GroupDtype], label="Group Size", multiselect=False, value="All", interactive=True,)
430
 
431
  with gr.Row():
432
+ with gr.Column(scale=6):
433
+ model_comparison = gr.CheckboxGroup(label="Accuracy Comparison on Selected Models", choices=list(selected_values.keys()), value=list(selected_values.keys()), interactive=True, elem_id="model_comparison")
434
  with gr.Column(scale=1):
435
+ spider_btn = gr.Button("Compare")
436
 
437
 
438
  leaderboard_table = gr.components.Dataframe(
 
455
  leaderboard_table.select(select, leaderboard_table, model_comparison)
456
  spider_btn.click(generate_spider_chart, [leaderboard_table, model_comparison], map)
457
  spider_btn.click(lambda: Modal(visible=True), None, modal)
458
+ demo.load(init_comparison_data, None, model_comparison)
459
 
460
  # Dummy leaderboard for handling the case when the user uses backspace key
461
  hidden_leaderboard_table_for_search = gr.components.Dataframe(