Spaces:
Runtime error
Runtime error
It is possible to download tournament results for each model and category (except Overall) in CSV format
Browse files
app.py
CHANGED
@@ -192,6 +192,17 @@ def fetch_model_tournament_results_table(submission_id, category):
|
|
192 |
visible=True,
|
193 |
)
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
def create_task_abbreviation_legend_table(category):
|
196 |
task_abbreviation_legend_body = []
|
197 |
abbreviation2name = leaderboard_server.CATEGORY_TO_TASK_ABBREVIATION_TO_DETAILS[category]
|
@@ -218,6 +229,9 @@ def change_leaderboard_category(category, selected_submission_id):
|
|
218 |
model_tournament_results_table = gr.update(
|
219 |
visible=False,
|
220 |
)
|
|
|
|
|
|
|
221 |
else:
|
222 |
task_abbreviation_legend = gr.update(
|
223 |
value=create_task_abbreviation_legend_table(category),
|
@@ -233,6 +247,7 @@ def change_leaderboard_category(category, selected_submission_id):
|
|
233 |
)
|
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),
|
@@ -250,6 +265,7 @@ def change_leaderboard_category(category, selected_submission_id):
|
|
250 |
tournament_results_title,
|
251 |
tournament_results_dropdown,
|
252 |
model_tournament_results_table,
|
|
|
253 |
)
|
254 |
|
255 |
def show_modal():
|
@@ -387,6 +403,12 @@ def gradio_app():
|
|
387 |
elem_classes="leaderboard-table-model-details",
|
388 |
)
|
389 |
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
category_of_tasks.change(
|
391 |
fn=change_leaderboard_category,
|
392 |
inputs=[
|
@@ -400,6 +422,7 @@ def gradio_app():
|
|
400 |
tournament_results_title,
|
401 |
tournament_results_dropdown,
|
402 |
model_tournament_results_table,
|
|
|
403 |
],
|
404 |
)
|
405 |
|
@@ -410,6 +433,13 @@ def gradio_app():
|
|
410 |
category_of_tasks,
|
411 |
],
|
412 |
outputs=model_tournament_results_table,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
)
|
414 |
|
415 |
with gr.TabItem('Model details'):
|
|
|
192 |
visible=True,
|
193 |
)
|
194 |
|
195 |
+
def fetch_model_tournament_results_table_csv(submission_id, category):
|
196 |
+
if submission_id == None:
|
197 |
+
return gr.update(
|
198 |
+
visible=False,
|
199 |
+
)
|
200 |
+
else:
|
201 |
+
return gr.update(
|
202 |
+
value=leaderboard_server.get_model_tournament_table_csv(submission_id, category),
|
203 |
+
visible=True,
|
204 |
+
)
|
205 |
+
|
206 |
def create_task_abbreviation_legend_table(category):
|
207 |
task_abbreviation_legend_body = []
|
208 |
abbreviation2name = leaderboard_server.CATEGORY_TO_TASK_ABBREVIATION_TO_DETAILS[category]
|
|
|
229 |
model_tournament_results_table = gr.update(
|
230 |
visible=False,
|
231 |
)
|
232 |
+
model_tournament_results_table_csv = gr.update(
|
233 |
+
visible=False,
|
234 |
+
)
|
235 |
else:
|
236 |
task_abbreviation_legend = gr.update(
|
237 |
value=create_task_abbreviation_legend_table(category),
|
|
|
247 |
)
|
248 |
|
249 |
model_tournament_results_table = fetch_model_tournament_results_table(selected_submission_id, category)
|
250 |
+
model_tournament_results_table_csv = fetch_model_tournament_results_table_csv(selected_submission_id, category)
|
251 |
|
252 |
leaderboard = gr.update(
|
253 |
value=leaderboard_server.get_leaderboard(category=category),
|
|
|
265 |
tournament_results_title,
|
266 |
tournament_results_dropdown,
|
267 |
model_tournament_results_table,
|
268 |
+
model_tournament_results_table_csv,
|
269 |
)
|
270 |
|
271 |
def show_modal():
|
|
|
403 |
elem_classes="leaderboard-table-model-details",
|
404 |
)
|
405 |
|
406 |
+
with gr.Row():
|
407 |
+
model_tournament_results_table_csv = gr.DownloadButton(
|
408 |
+
label="Download model tournament results in CSV format",
|
409 |
+
visible=False,
|
410 |
+
)
|
411 |
+
|
412 |
category_of_tasks.change(
|
413 |
fn=change_leaderboard_category,
|
414 |
inputs=[
|
|
|
422 |
tournament_results_title,
|
423 |
tournament_results_dropdown,
|
424 |
model_tournament_results_table,
|
425 |
+
model_tournament_results_table_csv,
|
426 |
],
|
427 |
)
|
428 |
|
|
|
433 |
category_of_tasks,
|
434 |
],
|
435 |
outputs=model_tournament_results_table,
|
436 |
+
).then(
|
437 |
+
fn=fetch_model_tournament_results_table_csv,
|
438 |
+
inputs=[
|
439 |
+
tournament_results_dropdown,
|
440 |
+
category_of_tasks,
|
441 |
+
],
|
442 |
+
outputs=model_tournament_results_table_csv,
|
443 |
)
|
444 |
|
445 |
with gr.TabItem('Model details'):
|
server.py
CHANGED
@@ -374,6 +374,10 @@ class LeaderboardServer:
|
|
374 |
df_css[c].iloc[i] = ''
|
375 |
return df_css
|
376 |
|
|
|
|
|
|
|
|
|
377 |
def get_model_tournament_table(self, submission_id, category):
|
378 |
with self.var_lock.ro:
|
379 |
return copy.copy(self.tournament_dataframes[submission_id][category])
|
|
|
374 |
df_css[c].iloc[i] = ''
|
375 |
return df_css
|
376 |
|
377 |
+
def get_model_tournament_table_csv(self, submission_id, category):
|
378 |
+
with self.var_lock.ro:
|
379 |
+
return self.tournament_dataframes_csv[submission_id][category]
|
380 |
+
|
381 |
def get_model_tournament_table(self, submission_id, category):
|
382 |
with self.var_lock.ro:
|
383 |
return copy.copy(self.tournament_dataframes[submission_id][category])
|