idolezal commited on
Commit
8f7d195
1 Parent(s): 96c0414

It is possible to download leaderboard for each category in CSV format

Browse files
Files changed (1) hide show
  1. app.py +34 -12
app.py CHANGED
@@ -133,7 +133,14 @@ def submit_results():
133
  gr.Info('Submission successful!')
134
 
135
  with leaderboard_server.var_lock.ro:
136
- leaderboard = leaderboard_server.get_leaderboard(category=leaderboard_server.TASKS_CATEGORY_OVERALL)
 
 
 
 
 
 
 
137
  submission_ids_and_titles = get_submission_ids_and_titles()
138
 
139
  return (
@@ -143,7 +150,8 @@ def submit_results():
143
  gr.update(visible=False),
144
  gr.update(visible=False),
145
  gr.update(visible=False),
146
- gr.DataFrame(value=leaderboard, visible=True),
 
147
  gr.update(visible=False),
148
  gr.update(choices=submission_ids_and_titles),
149
  gr.update(value=leaderboard_server.TASKS_CATEGORY_OVERALL),
@@ -226,12 +234,18 @@ def change_leaderboard_category(category, selected_submission_id):
226
 
227
  model_tournament_results_table = fetch_model_tournament_results_table(selected_submission_id, category)
228
 
 
 
 
 
 
 
 
 
 
229
  return (
230
- gr.update(
231
- value=leaderboard_server.get_leaderboard(category=category),
232
- visible=True,
233
- datatype="markdown",
234
- ),
235
  task_abbreviation_legend,
236
  tournament_results_title,
237
  tournament_results_dropdown,
@@ -249,14 +263,19 @@ def hide_modal():
249
 
250
  def on_application_load():
251
  with leaderboard_server.var_lock.ro:
252
- leaderboard = leaderboard_server.get_leaderboard(category=leaderboard_server.TASKS_CATEGORY_OVERALL)
 
 
 
 
 
 
 
253
  submission_ids_and_titles = get_submission_ids_and_titles()
254
 
255
  return (
256
- gr.update(
257
- value=leaderboard,
258
- visible=True,
259
- ),
260
  gr.update(choices=submission_ids_and_titles),
261
  gr.update(value=leaderboard_server.TASKS_CATEGORY_OVERALL),
262
  gr.update(choices=submission_ids_and_titles),
@@ -376,6 +395,7 @@ def gradio_app():
376
  ],
377
  outputs=[
378
  leaderboard_table,
 
379
  leaderboard_table_legend,
380
  tournament_results_title,
381
  tournament_results_dropdown,
@@ -498,6 +518,7 @@ def gradio_app():
498
  pre_submit_info,
499
  pre_submit_table,
500
  leaderboard_table,
 
501
  modal_submit,
502
  detail_dropdown,
503
  category_of_tasks,
@@ -527,6 +548,7 @@ def gradio_app():
527
  inputs=None,
528
  outputs=[
529
  leaderboard_table,
 
530
  detail_dropdown,
531
  category_of_tasks,
532
  tournament_results_dropdown,
 
133
  gr.Info('Submission successful!')
134
 
135
  with leaderboard_server.var_lock.ro:
136
+ leaderboard = gr.update(
137
+ value=leaderboard_server.get_leaderboard(category=leaderboard_server.TASKS_CATEGORY_OVERALL),
138
+ visible=True,
139
+ )
140
+ leaderboard_csv = gr.update(
141
+ value=leaderboard_server.get_leaderboard_csv(category=leaderboard_server.TASKS_CATEGORY_OVERALL),
142
+ visible=True,
143
+ )
144
  submission_ids_and_titles = get_submission_ids_and_titles()
145
 
146
  return (
 
150
  gr.update(visible=False),
151
  gr.update(visible=False),
152
  gr.update(visible=False),
153
+ leaderboard,
154
+ leaderboard_csv,
155
  gr.update(visible=False),
156
  gr.update(choices=submission_ids_and_titles),
157
  gr.update(value=leaderboard_server.TASKS_CATEGORY_OVERALL),
 
234
 
235
  model_tournament_results_table = fetch_model_tournament_results_table(selected_submission_id, category)
236
 
237
+ leaderboard = gr.update(
238
+ value=leaderboard_server.get_leaderboard(category=category),
239
+ visible=True,
240
+ )
241
+ leaderboard_csv = gr.update(
242
+ value=leaderboard_server.get_leaderboard_csv(category=category),
243
+ visible=True,
244
+ )
245
+
246
  return (
247
+ leaderboard,
248
+ leaderboard_csv,
 
 
 
249
  task_abbreviation_legend,
250
  tournament_results_title,
251
  tournament_results_dropdown,
 
263
 
264
  def on_application_load():
265
  with leaderboard_server.var_lock.ro:
266
+ leaderboard = gr.update(
267
+ value=leaderboard_server.get_leaderboard(category=leaderboard_server.TASKS_CATEGORY_OVERALL),
268
+ visible=True,
269
+ )
270
+ leaderboard_csv = gr.update(
271
+ value=leaderboard_server.get_leaderboard_csv(category=leaderboard_server.TASKS_CATEGORY_OVERALL),
272
+ visible=True,
273
+ )
274
  submission_ids_and_titles = get_submission_ids_and_titles()
275
 
276
  return (
277
+ leaderboard,
278
+ leaderboard_csv,
 
 
279
  gr.update(choices=submission_ids_and_titles),
280
  gr.update(value=leaderboard_server.TASKS_CATEGORY_OVERALL),
281
  gr.update(choices=submission_ids_and_titles),
 
395
  ],
396
  outputs=[
397
  leaderboard_table,
398
+ leaderboard_table_csv,
399
  leaderboard_table_legend,
400
  tournament_results_title,
401
  tournament_results_dropdown,
 
518
  pre_submit_info,
519
  pre_submit_table,
520
  leaderboard_table,
521
+ leaderboard_table_csv,
522
  modal_submit,
523
  detail_dropdown,
524
  category_of_tasks,
 
548
  inputs=None,
549
  outputs=[
550
  leaderboard_table,
551
+ leaderboard_table_csv,
552
  detail_dropdown,
553
  category_of_tasks,
554
  tournament_results_dropdown,