hynky HF staff commited on
Commit
6a95b89
·
1 Parent(s): 97e6937

only rerender on uer input

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -252,7 +252,7 @@ def load_task_data(repo_name, runs_to_fetch, checkpoint, task_name, tasks_files,
252
  combined_df = combined_df.reset_index()
253
  chosen_metrics = available_metrics[:1]
254
 
255
- return combined_df, render_table(combined_df, runs_to_fetch, chosen_metrics), gr.update(choices=available_metrics, value=chosen_metrics)
256
 
257
  with gr.Blocks() as demo:
258
  runs_checkpoints = gr.State({})
@@ -308,19 +308,30 @@ with gr.Blocks() as demo:
308
  fn=fetch_run_results,
309
  inputs=[repo, selected_runs, checkpoint],
310
  outputs=[task_name, tasks_files]
 
 
 
 
 
 
 
 
311
  )
312
-
313
 
314
  # Update results when task name or metric changes
315
  gr.on(
316
- triggers=[task_name.change],
317
  fn=load_task_data,
318
  inputs=[repo, selected_runs, checkpoint, task_name, tasks_files],
319
- outputs=[results_df_full, results_df, metric_names]
 
 
 
 
320
  )
321
 
322
  gr.on(
323
- triggers=[metric_names.change],
324
  fn=render_table,
325
  inputs=[results_df_full, selected_runs, metric_names],
326
  outputs=[results_df]
 
252
  combined_df = combined_df.reset_index()
253
  chosen_metrics = available_metrics[:1]
254
 
255
+ return combined_df, gr.update(choices=available_metrics, value=chosen_metrics)
256
 
257
  with gr.Blocks() as demo:
258
  runs_checkpoints = gr.State({})
 
308
  fn=fetch_run_results,
309
  inputs=[repo, selected_runs, checkpoint],
310
  outputs=[task_name, tasks_files]
311
+ ).then(
312
+ fn=load_task_data,
313
+ inputs=[repo, selected_runs, checkpoint, task_name, tasks_files],
314
+ outputs=[results_df_full, metric_names]
315
+ ).then(
316
+ fn=render_table,
317
+ inputs=[results_df_full, selected_runs, metric_names],
318
+ outputs=[results_df]
319
  )
 
320
 
321
  # Update results when task name or metric changes
322
  gr.on(
323
+ triggers=[task_name.input],
324
  fn=load_task_data,
325
  inputs=[repo, selected_runs, checkpoint, task_name, tasks_files],
326
+ outputs=[results_df_full, metric_names]
327
+ ).then(
328
+ fn=render_table,
329
+ inputs=[results_df_full, selected_runs, metric_names],
330
+ outputs=[results_df]
331
  )
332
 
333
  gr.on(
334
+ triggers=[metric_names.input],
335
  fn=render_table,
336
  inputs=[results_df_full, selected_runs, metric_names],
337
  outputs=[results_df]