Spaces:
Running
Running
Commit
Β·
eae3909
1
Parent(s):
7d08e8b
try fix again
Browse files
main.py
CHANGED
|
@@ -421,36 +421,40 @@ def main():
|
|
| 421 |
gr.Markdown("## π TabArena Leaderboards")
|
| 422 |
lb_matrix = LBMatrix()
|
| 423 |
|
| 424 |
-
# LIST TO STORE DEFERRED EVENT BINDINGS
|
| 425 |
-
# Tuples of (ParentComponent, ChildTriggerState)
|
| 426 |
-
deferred_bindings = []
|
| 427 |
-
|
| 428 |
-
# --- TABS LOGIC ---
|
| 429 |
with gr.Tabs(elem_classes="tab-buttons") as t_impute_tabs:
|
| 430 |
for impute_id, impute_t in enumerate(lb_matrix.imputation):
|
| 431 |
impute_t_name = lb_matrix.get_name_for_lb("imputation", impute_t)
|
| 432 |
-
|
| 433 |
-
with gr.TabItem(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 434 |
with gr.Tabs(elem_classes="tab-buttons"):
|
| 435 |
for splits_id, splits_t in enumerate(lb_matrix.splits):
|
| 436 |
splits_t_label = lb_matrix.get_name_for_lb(
|
| 437 |
"splits", splits_t
|
| 438 |
)
|
| 439 |
-
|
| 440 |
with gr.TabItem(
|
| 441 |
splits_t_label,
|
|
|
|
| 442 |
id=f"{impute_id}_{splits_id}",
|
| 443 |
) as t_splits:
|
|
|
|
| 444 |
with gr.Tabs(elem_classes="tab-buttons"):
|
| 445 |
for tasks_id, tasks_t in enumerate(lb_matrix.tasks):
|
| 446 |
tasks_t_name = lb_matrix.get_name_for_lb(
|
| 447 |
"tasks", tasks_t
|
| 448 |
)
|
| 449 |
-
|
| 450 |
with gr.TabItem(
|
| 451 |
tasks_t_name,
|
|
|
|
| 452 |
id=f"{impute_id}_{splits_id}_{tasks_id}",
|
| 453 |
) as t_tasks:
|
|
|
|
| 454 |
with gr.Tabs(elem_classes="tab-buttons"):
|
| 455 |
for (
|
| 456 |
datasets_id,
|
|
@@ -462,11 +466,14 @@ def main():
|
|
| 462 |
)
|
| 463 |
)
|
| 464 |
|
|
|
|
| 465 |
with gr.TabItem(
|
| 466 |
datasets_t_name,
|
|
|
|
| 467 |
id=f"{impute_id}_{splits_id}_{tasks_id}_{datasets_id}",
|
| 468 |
) as t_dataset:
|
| 469 |
-
#
|
|
|
|
| 470 |
is_absolute_first = (
|
| 471 |
impute_id == 0
|
| 472 |
and splits_id == 0
|
|
@@ -474,63 +481,82 @@ def main():
|
|
| 474 |
and datasets_id == 0
|
| 475 |
)
|
| 476 |
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 481 |
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
None,
|
| 486 |
-
load_trigger,
|
| 487 |
-
)
|
| 488 |
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
|
|
|
| 493 |
)
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
load_trigger,
|
| 499 |
)
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
(
|
| 504 |
-
|
|
|
|
| 505 |
load_trigger,
|
| 506 |
)
|
| 507 |
-
)
|
| 508 |
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
)
|
| 518 |
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
|
|
|
|
|
|
| 525 |
|
| 526 |
-
# --- APPLY DEFERRED BINDINGS ---
|
| 527 |
-
# Now that the block dictionary is stable, we can safely add cross-component events
|
| 528 |
-
for parent_tab, child_trigger in deferred_bindings:
|
| 529 |
-
parent_tab.select(lambda: True, None, child_trigger)
|
| 530 |
|
| 531 |
with gr.Row(), gr.Accordion("π Version History", open=False):
|
| 532 |
gr.Markdown(VERSION_HISTORY_BUTTON_TEXT, elem_classes="markdown-text")
|
| 533 |
|
|
|
|
| 534 |
demo.launch()
|
| 535 |
|
| 536 |
|
|
|
|
| 421 |
gr.Markdown("## π TabArena Leaderboards")
|
| 422 |
lb_matrix = LBMatrix()
|
| 423 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
with gr.Tabs(elem_classes="tab-buttons") as t_impute_tabs:
|
| 425 |
for impute_id, impute_t in enumerate(lb_matrix.imputation):
|
| 426 |
impute_t_name = lb_matrix.get_name_for_lb("imputation", impute_t)
|
| 427 |
+
# Capture the imputation tab object
|
| 428 |
+
with gr.TabItem(
|
| 429 |
+
impute_t_name,
|
| 430 |
+
elem_id="llm-benchmark-tab-table",
|
| 431 |
+
id=impute_id,
|
| 432 |
+
) as t_impute:
|
| 433 |
+
# Splits
|
| 434 |
with gr.Tabs(elem_classes="tab-buttons"):
|
| 435 |
for splits_id, splits_t in enumerate(lb_matrix.splits):
|
| 436 |
splits_t_label = lb_matrix.get_name_for_lb(
|
| 437 |
"splits", splits_t
|
| 438 |
)
|
| 439 |
+
# Capture the splits tab object
|
| 440 |
with gr.TabItem(
|
| 441 |
splits_t_label,
|
| 442 |
+
elem_id="llm-benchmark-tab-table",
|
| 443 |
id=f"{impute_id}_{splits_id}",
|
| 444 |
) as t_splits:
|
| 445 |
+
# Tasks
|
| 446 |
with gr.Tabs(elem_classes="tab-buttons"):
|
| 447 |
for tasks_id, tasks_t in enumerate(lb_matrix.tasks):
|
| 448 |
tasks_t_name = lb_matrix.get_name_for_lb(
|
| 449 |
"tasks", tasks_t
|
| 450 |
)
|
| 451 |
+
# Capture the tasks tab object
|
| 452 |
with gr.TabItem(
|
| 453 |
tasks_t_name,
|
| 454 |
+
elem_id="llm-benchmark-tab-table",
|
| 455 |
id=f"{impute_id}_{splits_id}_{tasks_id}",
|
| 456 |
) as t_tasks:
|
| 457 |
+
# Datasets
|
| 458 |
with gr.Tabs(elem_classes="tab-buttons"):
|
| 459 |
for (
|
| 460 |
datasets_id,
|
|
|
|
| 466 |
)
|
| 467 |
)
|
| 468 |
|
| 469 |
+
# Capture the final dataset tab object
|
| 470 |
with gr.TabItem(
|
| 471 |
datasets_t_name,
|
| 472 |
+
elem_id="llm-benchmark-tab-table",
|
| 473 |
id=f"{impute_id}_{splits_id}_{tasks_id}_{datasets_id}",
|
| 474 |
) as t_dataset:
|
| 475 |
+
# --- LOGIC ---
|
| 476 |
+
# Check if this is the absolute first tab
|
| 477 |
is_absolute_first = (
|
| 478 |
impute_id == 0
|
| 479 |
and splits_id == 0
|
|
|
|
| 481 |
and datasets_id == 0
|
| 482 |
)
|
| 483 |
|
| 484 |
+
if is_absolute_first:
|
| 485 |
+
# Immediate Render
|
| 486 |
+
render_details(
|
| 487 |
+
impute_t,
|
| 488 |
+
splits_t,
|
| 489 |
+
tasks_t,
|
| 490 |
+
datasets_t,
|
| 491 |
+
lb_matrix,
|
| 492 |
+
)
|
| 493 |
+
else:
|
| 494 |
+
# Lazy Loading
|
| 495 |
+
load_trigger = gr.State(
|
| 496 |
+
False
|
| 497 |
+
)
|
| 498 |
|
| 499 |
+
# Helper to set trigger to True
|
| 500 |
+
def activate_trigger():
|
| 501 |
+
return True
|
|
|
|
|
|
|
|
|
|
| 502 |
|
| 503 |
+
# 1. Always trigger if the USER clicks this specific tab
|
| 504 |
+
t_dataset.select(
|
| 505 |
+
activate_trigger,
|
| 506 |
+
None,
|
| 507 |
+
load_trigger,
|
| 508 |
)
|
| 509 |
+
|
| 510 |
+
# 2. Cascading Triggers:
|
| 511 |
+
# If this is the DEFAULT (first) child tab, it should also trigger
|
| 512 |
+
# when its parent is clicked.
|
| 513 |
+
if datasets_id == 0:
|
| 514 |
+
t_tasks.select(
|
| 515 |
+
activate_trigger,
|
| 516 |
+
None,
|
| 517 |
+
load_trigger,
|
| 518 |
+
)
|
| 519 |
+
|
| 520 |
+
# Continue up the chain:
|
| 521 |
+
# If this Task is also a default, clicking Split should trigger it.
|
| 522 |
+
if tasks_id == 0:
|
| 523 |
+
t_splits.select(
|
| 524 |
+
activate_trigger,
|
| 525 |
+
None,
|
| 526 |
load_trigger,
|
| 527 |
)
|
| 528 |
+
|
| 529 |
+
# If this Split is also a default, clicking Imputation should trigger it.
|
| 530 |
+
if splits_id == 0:
|
| 531 |
+
t_impute.select(
|
| 532 |
+
activate_trigger,
|
| 533 |
+
None,
|
| 534 |
load_trigger,
|
| 535 |
)
|
|
|
|
| 536 |
|
| 537 |
+
renderer = partial(
|
| 538 |
+
render_details,
|
| 539 |
+
imputation=impute_t,
|
| 540 |
+
splits=splits_t,
|
| 541 |
+
tasks=tasks_t,
|
| 542 |
+
datasets=datasets_t,
|
| 543 |
+
lb_matrix=lb_matrix,
|
| 544 |
+
)
|
|
|
|
| 545 |
|
| 546 |
+
@gr.render(
|
| 547 |
+
inputs=load_trigger
|
| 548 |
+
)
|
| 549 |
+
def lazy_load(triggered):
|
| 550 |
+
if triggered:
|
| 551 |
+
renderer()
|
| 552 |
+
else:
|
| 553 |
+
gr.Markdown("<i>Loading results...</i>")
|
| 554 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 555 |
|
| 556 |
with gr.Row(), gr.Accordion("π Version History", open=False):
|
| 557 |
gr.Markdown(VERSION_HISTORY_BUTTON_TEXT, elem_classes="markdown-text")
|
| 558 |
|
| 559 |
+
demo.queue(default_concurrency_limit=40)
|
| 560 |
demo.launch()
|
| 561 |
|
| 562 |
|