idolezal commited on
Commit
ca14598
1 Parent(s): 136803a

For the progress info used Markdown instead of Slider

Browse files
Files changed (1) hide show
  1. app.py +21 -11
app.py CHANGED
@@ -291,6 +291,18 @@ def enable_submit_buttons():
291
  def results_dataset_integrity_check():
292
  leaderboard_server.results_dataset_integrity_check(solve=True)
293
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  def on_tournament_results_corrupted():
295
  if leaderboard_server.tournament_results_corrupted and not leaderboard_server.tournament_results_integrity_solving:
296
  results_dataset_integrity_check_btn = gr.update(
@@ -306,7 +318,6 @@ def on_tournament_results_corrupted():
306
  visible=False,
307
  )
308
  results_dataset_integrity_solving_progress = gr.update(
309
- value=leaderboard_server.tournament_results_integrity_solving_progress * 100,
310
  visible=True,
311
  )
312
 
@@ -369,29 +380,25 @@ def gradio_app():
369
  gr.Markdown(HEADER_MARKDOWN)
370
 
371
  if leaderboard_server.tournament_results_corrupted:
 
 
372
  results_dataset_integrity_check_btn = gr.Button(
373
  value='Check integrity of results dataset',
374
  interactive=True,
375
  visible=False,
376
  )
377
 
378
- results_dataset_integrity_solving_progress = gr.Slider(
379
- minimum=0,
380
- maximum=100,
381
- value=leaderboard_server.tournament_results_integrity_solving_progress * 100,
382
- label="Tournament results is preparing, please wait…",
383
- interactive=False,
384
  visible=False,
385
  )
386
 
387
  results_dataset_integrity_solving_progress_timer = gr.Timer(
388
- value=2,
389
  )
390
 
391
  results_dataset_integrity_solving_progress_timer.tick(
392
- fn=lambda: gr.update(
393
- value=leaderboard_server.tournament_results_integrity_solving_progress * 100
394
- ),
395
  outputs=results_dataset_integrity_solving_progress
396
  )
397
 
@@ -414,6 +421,9 @@ def gradio_app():
414
  results_dataset_integrity_check_btn,
415
  results_dataset_integrity_solving_progress,
416
  ]
 
 
 
417
  )
418
 
419
  return main
 
291
  def results_dataset_integrity_check():
292
  leaderboard_server.results_dataset_integrity_check(solve=True)
293
 
294
+ def update_results_dataset_integrity_solving_progress():
295
+ progress = leaderboard_server.tournament_results_integrity_solving_progress * 100
296
+
297
+ if progress < 100:
298
+ return gr.update(
299
+ value=f"Tournament results is preparing, please wait… {progress:.0f}% done"
300
+ )
301
+ else:
302
+ return gr.update(
303
+ value="Tournament results is prepared, please refresh this page in your browser (e.g. by pressing F5)."
304
+ )
305
+
306
  def on_tournament_results_corrupted():
307
  if leaderboard_server.tournament_results_corrupted and not leaderboard_server.tournament_results_integrity_solving:
308
  results_dataset_integrity_check_btn = gr.update(
 
318
  visible=False,
319
  )
320
  results_dataset_integrity_solving_progress = gr.update(
 
321
  visible=True,
322
  )
323
 
 
380
  gr.Markdown(HEADER_MARKDOWN)
381
 
382
  if leaderboard_server.tournament_results_corrupted:
383
+ gr.Markdown("## Results dataset integrity solving")
384
+
385
  results_dataset_integrity_check_btn = gr.Button(
386
  value='Check integrity of results dataset',
387
  interactive=True,
388
  visible=False,
389
  )
390
 
391
+ results_dataset_integrity_solving_progress = gr.Markdown(
392
+ value=None,
 
 
 
 
393
  visible=False,
394
  )
395
 
396
  results_dataset_integrity_solving_progress_timer = gr.Timer(
397
+ value=60, # seconds
398
  )
399
 
400
  results_dataset_integrity_solving_progress_timer.tick(
401
+ fn=update_results_dataset_integrity_solving_progress,
 
 
402
  outputs=results_dataset_integrity_solving_progress
403
  )
404
 
 
421
  results_dataset_integrity_check_btn,
422
  results_dataset_integrity_solving_progress,
423
  ]
424
+ ).then(
425
+ fn=update_results_dataset_integrity_solving_progress,
426
+ outputs=results_dataset_integrity_solving_progress
427
  )
428
 
429
  return main