albertvillanova HF staff commited on
Commit
07448fb
1 Parent(s): 0d84f54

Add Clear Details button

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -249,6 +249,14 @@ def update_sample_idx_component(*dfs):
249
  )
250
 
251
 
 
 
 
 
 
 
 
 
252
  # if __name__ == "__main__":
253
  latest_result_path_per_model = filter_latest_result_path_per_model(fetch_result_paths())
254
 
@@ -295,6 +303,7 @@ with gr.Blocks(fill_height=True) as demo:
295
  info="Evaluation subtasks to be displayed (choose one of the Tasks above)",
296
  )
297
  load_details_btn = gr.Button("Load Details", interactive=False)
 
298
  sample_idx = gr.Number(
299
  label="Sample Index",
300
  info="Index of the sample to be displayed",
@@ -356,5 +365,9 @@ with gr.Blocks(fill_height=True) as demo:
356
  inputs=[sample_idx, details_dataframe_1, details_dataframe_2],
357
  outputs=details,
358
  )
 
 
 
 
359
 
360
  demo.launch()
 
249
  )
250
 
251
 
252
+ def clear_details():
253
+ # model_id_1, model_id_2, details_dataframe_1, details_dataframe_2, details_task, subtask, sample_idx
254
+ return (
255
+ None, None, None, None, None, None,
256
+ gr.Number(label="Sample Index", info="Index of the sample to be displayed", value=0, minimum=0,visible=False),
257
+ )
258
+
259
+
260
  # if __name__ == "__main__":
261
  latest_result_path_per_model = filter_latest_result_path_per_model(fetch_result_paths())
262
 
 
303
  info="Evaluation subtasks to be displayed (choose one of the Tasks above)",
304
  )
305
  load_details_btn = gr.Button("Load Details", interactive=False)
306
+ clear_details_btn = gr.Button("Clear Details")
307
  sample_idx = gr.Number(
308
  label="Sample Index",
309
  info="Index of the sample to be displayed",
 
365
  inputs=[sample_idx, details_dataframe_1, details_dataframe_2],
366
  outputs=details,
367
  )
368
+ clear_details_btn.click(
369
+ fn=clear_details,
370
+ outputs=[model_id_1, model_id_2, details_dataframe_1, details_dataframe_2, details_task, subtask, sample_idx],
371
+ )
372
 
373
  demo.launch()