Spaces:
Runtime error
Runtime error
Added tournament results table to "Model details" tab
Browse files
app.py
CHANGED
@@ -182,7 +182,7 @@ def fetch_model_detail(submission_id):
|
|
182 |
)
|
183 |
|
184 |
def fetch_model_tournament_results_table(submission_id, category):
|
185 |
-
if submission_id == None:
|
186 |
return gr.update(
|
187 |
visible=False,
|
188 |
)
|
@@ -193,7 +193,7 @@ def fetch_model_tournament_results_table(submission_id, category):
|
|
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 |
)
|
@@ -350,7 +350,7 @@ def gradio_app():
|
|
350 |
gr.Markdown(LEADERBOARD_TAB_TITLE_MARKDOWN)
|
351 |
|
352 |
with gr.Row():
|
353 |
-
|
354 |
choices=[leaderboard_server.TASKS_CATEGORY_OVERALL] + sorted(leaderboard_server.TASKS_CATEGORIES),
|
355 |
value=leaderboard_server.TASKS_CATEGORY_OVERALL,
|
356 |
label="Category of benchmarks",
|
@@ -420,10 +420,10 @@ def gradio_app():
|
|
420 |
visible=False,
|
421 |
)
|
422 |
|
423 |
-
|
424 |
fn=change_leaderboard_category,
|
425 |
inputs=[
|
426 |
-
|
427 |
tournament_results_dropdown,
|
428 |
],
|
429 |
outputs=[
|
@@ -441,14 +441,14 @@ def gradio_app():
|
|
441 |
fn=fetch_model_tournament_results_table,
|
442 |
inputs=[
|
443 |
tournament_results_dropdown,
|
444 |
-
|
445 |
],
|
446 |
outputs=model_tournament_results_table,
|
447 |
).then(
|
448 |
fn=fetch_model_tournament_results_table_csv,
|
449 |
inputs=[
|
450 |
tournament_results_dropdown,
|
451 |
-
|
452 |
],
|
453 |
outputs=model_tournament_results_table_csv,
|
454 |
)
|
@@ -456,22 +456,92 @@ def gradio_app():
|
|
456 |
with gr.TabItem('Model details'):
|
457 |
gr.Markdown(MORE_DETAILS_MARKDOWN)
|
458 |
|
459 |
-
detail_dropdown = gr.Dropdown(
|
460 |
-
choices=submission_ids_and_titles,
|
461 |
-
label="Select model",
|
462 |
-
interactive=True,
|
463 |
-
)
|
464 |
-
|
465 |
with gr.Row():
|
466 |
-
|
467 |
-
|
|
|
|
|
|
|
468 |
|
469 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
fn=fetch_model_detail,
|
471 |
-
inputs=[
|
472 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
)
|
474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
with gr.TabItem('Submission'):
|
476 |
with gr.Column():
|
477 |
gr.Markdown(SUBMISSION_TAB_TITLE_MARKDOWN)
|
@@ -568,8 +638,8 @@ def gradio_app():
|
|
568 |
leaderboard_table,
|
569 |
leaderboard_table_csv,
|
570 |
modal_submit,
|
571 |
-
|
572 |
-
|
573 |
tournament_results_dropdown,
|
574 |
],
|
575 |
).then(
|
@@ -617,8 +687,8 @@ def gradio_app():
|
|
617 |
outputs=[
|
618 |
leaderboard_table,
|
619 |
leaderboard_table_csv,
|
620 |
-
|
621 |
-
|
622 |
tournament_results_dropdown,
|
623 |
]
|
624 |
)
|
|
|
182 |
)
|
183 |
|
184 |
def fetch_model_tournament_results_table(submission_id, category):
|
185 |
+
if submission_id == None or category == None:
|
186 |
return gr.update(
|
187 |
visible=False,
|
188 |
)
|
|
|
193 |
)
|
194 |
|
195 |
def fetch_model_tournament_results_table_csv(submission_id, category):
|
196 |
+
if submission_id == None or category == None:
|
197 |
return gr.update(
|
198 |
visible=False,
|
199 |
)
|
|
|
350 |
gr.Markdown(LEADERBOARD_TAB_TITLE_MARKDOWN)
|
351 |
|
352 |
with gr.Row():
|
353 |
+
leaderboard_category_of_tasks = gr.Dropdown(
|
354 |
choices=[leaderboard_server.TASKS_CATEGORY_OVERALL] + sorted(leaderboard_server.TASKS_CATEGORIES),
|
355 |
value=leaderboard_server.TASKS_CATEGORY_OVERALL,
|
356 |
label="Category of benchmarks",
|
|
|
420 |
visible=False,
|
421 |
)
|
422 |
|
423 |
+
leaderboard_category_of_tasks.change(
|
424 |
fn=change_leaderboard_category,
|
425 |
inputs=[
|
426 |
+
leaderboard_category_of_tasks,
|
427 |
tournament_results_dropdown,
|
428 |
],
|
429 |
outputs=[
|
|
|
441 |
fn=fetch_model_tournament_results_table,
|
442 |
inputs=[
|
443 |
tournament_results_dropdown,
|
444 |
+
leaderboard_category_of_tasks,
|
445 |
],
|
446 |
outputs=model_tournament_results_table,
|
447 |
).then(
|
448 |
fn=fetch_model_tournament_results_table_csv,
|
449 |
inputs=[
|
450 |
tournament_results_dropdown,
|
451 |
+
leaderboard_category_of_tasks,
|
452 |
],
|
453 |
outputs=model_tournament_results_table_csv,
|
454 |
)
|
|
|
456 |
with gr.TabItem('Model details'):
|
457 |
gr.Markdown(MORE_DETAILS_MARKDOWN)
|
458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
with gr.Row():
|
460 |
+
model_details_model_dropdown = gr.Dropdown(
|
461 |
+
choices=submission_ids_and_titles,
|
462 |
+
label="Select model",
|
463 |
+
interactive=True,
|
464 |
+
)
|
465 |
|
466 |
+
with gr.Row():
|
467 |
+
model_details_description = gr.Text(value='', label='Model description', visible=False, interactive=False)
|
468 |
+
model_details_url = gr.Text(value='', label='Model url', visible=False, interactive=False)
|
469 |
+
|
470 |
+
with gr.Row():
|
471 |
+
model_details_tournament_results_title = gr.Markdown(
|
472 |
+
value="## Tournament results for selected model",
|
473 |
+
visible=False,
|
474 |
+
)
|
475 |
+
|
476 |
+
with gr.Row():
|
477 |
+
model_details_category_of_tasks = gr.Dropdown(
|
478 |
+
choices=sorted(leaderboard_server.TASKS_CATEGORIES),
|
479 |
+
value=None,
|
480 |
+
label="Category of benchmarks",
|
481 |
+
visible=False,
|
482 |
+
interactive=True,
|
483 |
+
)
|
484 |
+
|
485 |
+
with gr.Row():
|
486 |
+
model_details_model_tournament_results_table = gr.DataFrame(
|
487 |
+
value=None,
|
488 |
+
datatype="markdown",
|
489 |
+
label="The model won against…",
|
490 |
+
visible=False,
|
491 |
+
interactive=False,
|
492 |
+
elem_classes="leaderboard-table-model-details",
|
493 |
+
)
|
494 |
+
|
495 |
+
with gr.Row():
|
496 |
+
model_details_model_tournament_results_table_csv = gr.DownloadButton(
|
497 |
+
label="Download model tournament results in CSV format",
|
498 |
+
visible=False,
|
499 |
+
)
|
500 |
+
|
501 |
+
model_details_model_dropdown.change(
|
502 |
fn=fetch_model_detail,
|
503 |
+
inputs=[model_details_model_dropdown],
|
504 |
+
outputs=[model_details_description, model_details_url],
|
505 |
+
).then(
|
506 |
+
fn=lambda submission_id: gr.update(visible=True) if submission_id else gr.update(visible=False),
|
507 |
+
inputs=model_details_model_dropdown,
|
508 |
+
outputs=model_details_tournament_results_title
|
509 |
+
).then(
|
510 |
+
fn=lambda submission_id: gr.update(visible=True) if submission_id else gr.update(visible=False),
|
511 |
+
inputs=model_details_model_dropdown,
|
512 |
+
outputs=model_details_category_of_tasks
|
513 |
+
).then(
|
514 |
+
fn=fetch_model_tournament_results_table,
|
515 |
+
inputs=[
|
516 |
+
model_details_model_dropdown,
|
517 |
+
model_details_category_of_tasks,
|
518 |
+
],
|
519 |
+
outputs=model_details_model_tournament_results_table
|
520 |
+
).then(
|
521 |
+
fn=fetch_model_tournament_results_table_csv,
|
522 |
+
inputs=[
|
523 |
+
model_details_model_dropdown,
|
524 |
+
model_details_category_of_tasks,
|
525 |
+
],
|
526 |
+
outputs=model_details_model_tournament_results_table_csv
|
527 |
)
|
528 |
+
|
529 |
+
model_details_category_of_tasks.change(
|
530 |
+
fn=fetch_model_tournament_results_table,
|
531 |
+
inputs=[
|
532 |
+
model_details_model_dropdown,
|
533 |
+
model_details_category_of_tasks,
|
534 |
+
],
|
535 |
+
outputs=model_details_model_tournament_results_table,
|
536 |
+
).then(
|
537 |
+
fn=fetch_model_tournament_results_table_csv,
|
538 |
+
inputs=[
|
539 |
+
model_details_model_dropdown,
|
540 |
+
model_details_category_of_tasks,
|
541 |
+
],
|
542 |
+
outputs=model_details_model_tournament_results_table_csv,
|
543 |
+
)
|
544 |
+
|
545 |
with gr.TabItem('Submission'):
|
546 |
with gr.Column():
|
547 |
gr.Markdown(SUBMISSION_TAB_TITLE_MARKDOWN)
|
|
|
638 |
leaderboard_table,
|
639 |
leaderboard_table_csv,
|
640 |
modal_submit,
|
641 |
+
model_details_model_dropdown,
|
642 |
+
leaderboard_category_of_tasks,
|
643 |
tournament_results_dropdown,
|
644 |
],
|
645 |
).then(
|
|
|
687 |
outputs=[
|
688 |
leaderboard_table,
|
689 |
leaderboard_table_csv,
|
690 |
+
model_details_model_dropdown,
|
691 |
+
leaderboard_category_of_tasks,
|
692 |
tournament_results_dropdown,
|
693 |
]
|
694 |
)
|