mgyigit commited on
Commit
90fcb15
1 Parent(s): b76dece

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -41,9 +41,9 @@ def add_new_eval(
41
 
42
  return 0
43
 
44
- # Function to update leaderboard dynamically based on user selection
45
- def update_leaderboard(selected_methods, selected_metrics):
46
- return get_baseline_df(selected_methods, selected_metrics)
47
 
48
  block = gr.Blocks()
49
 
@@ -56,7 +56,7 @@ with block:
56
  leaderboard = get_baseline_df(None, None) #get baseline leaderboard without filtering
57
 
58
  method_names = leaderboard['Method'].unique().tolist()
59
- metric_names = leaderboard(CSV_RESULT_PATH).columns.tolist()
60
  metrics_with_method = metric_names.copy()
61
  metric_names.remove('Method') # Remove method_name from the metric options
62
 
@@ -85,12 +85,12 @@ with block:
85
 
86
  # Update leaderboard when method/metric selection changes
87
  leaderboard_method_selector.change(
88
- update_leaderboard,
89
  inputs=[leaderboard_method_selector, leaderboard_metric_selector],
90
  outputs=data_component
91
  )
92
  leaderboard_metric_selector.change(
93
- update_leaderboard,
94
  inputs=[leaderboard_method_selector, leaderboard_metric_selector],
95
  outputs=data_component
96
  )
@@ -214,10 +214,6 @@ with block:
214
  ],
215
  )
216
 
217
- def refresh_data():
218
- value = get_baseline_df(method_names, metric_names)
219
- return value
220
-
221
  with gr.Row():
222
  data_run = gr.Button("Refresh")
223
  data_run.click(refresh_data, outputs=[data_component])
 
41
 
42
  return 0
43
 
44
+ def refresh_data():
45
+ df = get_baseline_df(method_names, metric_names)
46
+ return df
47
 
48
  block = gr.Blocks()
49
 
 
56
  leaderboard = get_baseline_df(None, None) #get baseline leaderboard without filtering
57
 
58
  method_names = leaderboard['Method'].unique().tolist()
59
+ metric_names = leaderboard.columns.tolist()
60
  metrics_with_method = metric_names.copy()
61
  metric_names.remove('Method') # Remove method_name from the metric options
62
 
 
85
 
86
  # Update leaderboard when method/metric selection changes
87
  leaderboard_method_selector.change(
88
+ get_baseline_df,
89
  inputs=[leaderboard_method_selector, leaderboard_metric_selector],
90
  outputs=data_component
91
  )
92
  leaderboard_metric_selector.change(
93
+ get_baseline_df,
94
  inputs=[leaderboard_method_selector, leaderboard_metric_selector],
95
  outputs=data_component
96
  )
 
214
  ],
215
  )
216
 
 
 
 
 
217
  with gr.Row():
218
  data_run = gr.Button("Refresh")
219
  data_run.click(refresh_data, outputs=[data_component])