Spaces:
Running
Running
Amber Tanaka
commited on
Ux fixes (#7)
Browse files- app.py +4 -4
- c_and_e.py +3 -4
- content.py +78 -6
- data_analysis.py +3 -4
- e2e.py +3 -4
- leaderboard_transformer.py +3 -2
- literature_understanding.py +1 -1
- main_page.py +10 -3
- ui_components.py +4 -4
app.py
CHANGED
|
@@ -79,16 +79,16 @@ demo = gr.Blocks(theme=theme, css=css)
|
|
| 79 |
with demo:
|
| 80 |
render_logo()
|
| 81 |
main_page.demo.render()
|
| 82 |
-
with demo.route("Literature Understanding"):
|
| 83 |
render_logo()
|
| 84 |
literature_understanding.demo.render()
|
| 85 |
-
with demo.route("Code & Execution"):
|
| 86 |
render_logo()
|
| 87 |
c_and_e.demo.render()
|
| 88 |
-
with demo.route("Data Analysis"):
|
| 89 |
render_logo()
|
| 90 |
data_analysis.demo.render()
|
| 91 |
-
with demo.route("Discovery"):
|
| 92 |
render_logo()
|
| 93 |
e2e.demo.render()
|
| 94 |
with demo.route(" 🚀 Submit an Agent"):
|
|
|
|
| 79 |
with demo:
|
| 80 |
render_logo()
|
| 81 |
main_page.demo.render()
|
| 82 |
+
with demo.route("Literature Understanding", "/literature-understanding"):
|
| 83 |
render_logo()
|
| 84 |
literature_understanding.demo.render()
|
| 85 |
+
with demo.route("Code & Execution", "/code-execution"):
|
| 86 |
render_logo()
|
| 87 |
c_and_e.demo.render()
|
| 88 |
+
with demo.route("Data Analysis", "/data-analysis"):
|
| 89 |
render_logo()
|
| 90 |
data_analysis.demo.render()
|
| 91 |
+
with demo.route("Discovery", "/discovery"):
|
| 92 |
render_logo()
|
| 93 |
e2e.demo.render()
|
| 94 |
with demo.route(" 🚀 Submit an Agent"):
|
c_and_e.py
CHANGED
|
@@ -3,18 +3,17 @@ import pandas as pd
|
|
| 3 |
|
| 4 |
# Import our UI factories and the data loader
|
| 5 |
from ui_components import create_leaderboard_display, create_benchmark_details_display, get_full_leaderboard_data,create_sub_navigation_bar
|
| 6 |
-
from content import
|
| 7 |
# Define the category for this page
|
| 8 |
CATEGORY_NAME = "Code Execution"
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
-
gr.Markdown(f"## {CATEGORY_NAME}
|
| 12 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 13 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 14 |
-
gr.Markdown(
|
| 15 |
with gr.Column(elem_id="validation_nav_container", visible=True) as validation_nav_container:
|
| 16 |
create_sub_navigation_bar(validation_tag_map, CATEGORY_NAME)
|
| 17 |
-
|
| 18 |
with gr.Column(elem_id="test_nav_container", visible=False) as test_nav_container:
|
| 19 |
create_sub_navigation_bar(test_tag_map, CATEGORY_NAME)
|
| 20 |
|
|
|
|
| 3 |
|
| 4 |
# Import our UI factories and the data loader
|
| 5 |
from ui_components import create_leaderboard_display, create_benchmark_details_display, get_full_leaderboard_data,create_sub_navigation_bar
|
| 6 |
+
from content import CODE_EXECUTION_DESCRIPTION
|
| 7 |
# Define the category for this page
|
| 8 |
CATEGORY_NAME = "Code Execution"
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
+
gr.Markdown(f"## Astabench {CATEGORY_NAME} Leaderboard")
|
| 12 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 13 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 14 |
+
gr.Markdown(CODE_EXECUTION_DESCRIPTION, elem_id="category-intro")
|
| 15 |
with gr.Column(elem_id="validation_nav_container", visible=True) as validation_nav_container:
|
| 16 |
create_sub_navigation_bar(validation_tag_map, CATEGORY_NAME)
|
|
|
|
| 17 |
with gr.Column(elem_id="test_nav_container", visible=False) as test_nav_container:
|
| 18 |
create_sub_navigation_bar(test_tag_map, CATEGORY_NAME)
|
| 19 |
|
content.py
CHANGED
|
@@ -1,21 +1,93 @@
|
|
| 1 |
TITLE = """<h1 align="left" id="space-title">AstaBench Leaderboard</h1>"""
|
| 2 |
|
| 3 |
INTRO_PARAGRAPH = """
|
| 4 |
-
AI
|
| 5 |
<br>
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
"""
|
| 8 |
SCATTER_DISCLAIMER = """
|
| 9 |
-
Only agents
|
| 10 |
"""
|
| 11 |
PARETO_DISCLAIMER = """
|
| 12 |
Agents names that are green are Pareto optimal, meaning they achieve the best performance for their cost.
|
| 13 |
"""
|
| 14 |
LIT_DESCRIPTION = """
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
"""
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
"""
|
| 20 |
|
| 21 |
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
|
|
|
|
| 1 |
TITLE = """<h1 align="left" id="space-title">AstaBench Leaderboard</h1>"""
|
| 2 |
|
| 3 |
INTRO_PARAGRAPH = """
|
| 4 |
+
Newer benchmarks may test agentic AI and isolated aspects of scientific reasoning, but none rigorously measure agentic AI or capture the full range of skills research demands. Agents can appear effective by simply retrying tasks—often at high computational cost and with inconsistent results. Scientific AI needs evaluations that reflect the real complexity of research.
|
| 5 |
<br>
|
| 6 |
+
<br>
|
| 7 |
+
AstaBench fills that gap: a suite of open benchmarks for evaluating scientific AI assistants on core scientific tasks that require novel reasoning. The suite includes over 8,000 tasks across 11 benchmarks, organized into four core categories: Literature Understanding, Code & Execution, Data Analysis, and End-to-End Discovery.
|
| 8 |
+
<br>
|
| 9 |
+
<br>
|
| 10 |
+
The **AstaBench Leaderboard** below provides a high-level summary of agent performance and efficiency. It includes:
|
| 11 |
+
<br>
|
| 12 |
+
<br>
|
| 13 |
+
- An **overall score**, computed as a macro average of the four category-level macro averages, ensuring each domain contributes equally—regardless of how many benchmarks each category includes. This provides a fair and balanced comparison across agents with varying capabilities.
|
| 14 |
+
- An **overall average cost per task**, consistently aggregated across all categories, to reflect the real efficiency of each agent under comparable conditions.
|
| 15 |
+
<br>
|
| 16 |
+
To support domain-specific insight, AstaBench also provides per-category leaderboards:
|
| 17 |
+
<br>
|
| 18 |
+
<br>
|
| 19 |
+
- Literature Understanding
|
| 20 |
+
<br>
|
| 21 |
+
- Code & Execution
|
| 22 |
+
<br>
|
| 23 |
+
- Data Analysis
|
| 24 |
+
<br>
|
| 25 |
+
- End-to-End Discovery
|
| 26 |
+
<br>
|
| 27 |
+
Each category page includes a summary table (average score and cost per problem for that domain), as well as per-benchmark leaderboards for detailed comparisons on specific tasks.
|
| 28 |
+
<br>
|
| 29 |
+
<br>
|
| 30 |
+
🔍 Learn more in the AstaBench technical blog post
|
| 31 |
"""
|
| 32 |
SCATTER_DISCLAIMER = """
|
| 33 |
+
Note: Only agents with valid cost data are shown in the scatter plot, as both performance and efficiency are required for comparison. Agents without cost data still appear in the tables below.
|
| 34 |
"""
|
| 35 |
PARETO_DISCLAIMER = """
|
| 36 |
Agents names that are green are Pareto optimal, meaning they achieve the best performance for their cost.
|
| 37 |
"""
|
| 38 |
LIT_DESCRIPTION = """
|
| 39 |
+
The **Literature Understanding** category evaluates how well agents comprehend and interact with scientific literature—testing their ability to find research papers, assess citation quality, extract information from text, and more.
|
| 40 |
+
<br>
|
| 41 |
+
The scores shown below reflect performance aggregated across five distinct benchmarks, each targeting a different aspect of literature-based reasoning:
|
| 42 |
+
<br>
|
| 43 |
+
- PaperFinding Bench – PLACEHOLDER DESCRIPTION
|
| 44 |
+
<br>
|
| 45 |
+
- ScholarQA Bench2 – PLACEHOLDER DESCRIPTION
|
| 46 |
+
<br>
|
| 47 |
+
- LitQA2-FT – PLACEHOLDER DESCRIPTION
|
| 48 |
+
<br>
|
| 49 |
+
- ArxivDIGES Tables-Clean – PLACEHOLDER DESCRIPTION
|
| 50 |
+
<br>
|
| 51 |
+
<br>
|
| 52 |
+
Together, these tasks form a comprehensive evaluation of an agent’s ability to navigate, understand, and reason over scientific publications
|
| 53 |
+
"""
|
| 54 |
+
CODE_EXECUTION_DESCRIPTION = """
|
| 55 |
+
The **Code & Execution** category in AstaBench includes tasks that evaluate an agent’s ability to write, modify, and run code in realistic research scenarios. Unlike literature tasks—which can sometimes be solved by a language model alone—these problems often require the agent to interact with tools: reading input files, executing code, and writing outputs to specific files in the required format.
|
| 56 |
+
<br>
|
| 57 |
+
<br>
|
| 58 |
+
The scores in this category are aggregated from three distinct benchmarks, each targeting different facets of scientific coding and execution:
|
| 59 |
+
<br>
|
| 60 |
+
- CORE-Bench-Hard – PLACEHOLDER DESCRIPTION
|
| 61 |
+
<br>
|
| 62 |
+
- DS-1000 – PLACEHOLDER DESCRIPTION
|
| 63 |
+
<br>
|
| 64 |
+
- SUPER-Expert – PLACEHOLDER DESCRIPTION
|
| 65 |
+
<br>
|
| 66 |
+
<br>
|
| 67 |
+
Together, these benchmarks evaluate whether an agent can function as a hands-on scientific assistant—not just by reasoning about code, but by running it in real-world contexts.
|
| 68 |
+
"""
|
| 69 |
+
DATA_ANALYSIS_DESCRIPTION = """
|
| 70 |
+
The **Data Analysis** category evaluates agents on their ability to analyze structured datasets and generate meaningful scientific hypotheses. It currently includes a single benchmark:
|
| 71 |
+
<br>
|
| 72 |
+
- DiscoveryBench
|
| 73 |
+
<br>
|
| 74 |
+
so the category-level scores are the same as the benchmark-level results.
|
| 75 |
+
<br>
|
| 76 |
+
<br>
|
| 77 |
+
As additional benchmarks are added in the future, this category will expand to cover a broader range of data-driven reasoning tasks across scientific domains.
|
| 78 |
"""
|
| 79 |
+
DISCOVERY_DESCRIPTION = """
|
| 80 |
+
The **End-to-End Discovery** category tests whether agents can carry out a complete scientific workflow—from hypothesis generation and experiment design to code execution, analysis, and report writing. These tasks require agents to integrate multiple capabilities, producing not just answers but full research artifacts.
|
| 81 |
+
<br>
|
| 82 |
+
<br>
|
| 83 |
+
Scores in this category are aggregated from two benchmarks:
|
| 84 |
+
<br>
|
| 85 |
+
- E2E-Bench – PLACEHOLDER DESCRIPTION
|
| 86 |
+
<br>
|
| 87 |
+
- E2E-Bench-Hard – PLACEHOLDER DESCRIPTION
|
| 88 |
+
<br>
|
| 89 |
+
<br>
|
| 90 |
+
This category provides the first standardized way to evaluate automated scientific discovery (ASD) agents across all stages of the research process.
|
| 91 |
"""
|
| 92 |
|
| 93 |
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
|
data_analysis.py
CHANGED
|
@@ -3,18 +3,17 @@ import pandas as pd
|
|
| 3 |
|
| 4 |
# Import our UI factories and the data loader
|
| 5 |
from ui_components import create_leaderboard_display, create_benchmark_details_display, get_full_leaderboard_data, create_sub_navigation_bar
|
| 6 |
-
from content import
|
| 7 |
# Define the category for this page
|
| 8 |
CATEGORY_NAME = "Data Analysis"
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
-
gr.Markdown(f"## {CATEGORY_NAME}
|
| 12 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 13 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 14 |
-
gr.Markdown(
|
| 15 |
with gr.Column(elem_id="validation_nav_container", visible=True) as validation_nav_container:
|
| 16 |
create_sub_navigation_bar(validation_tag_map, CATEGORY_NAME)
|
| 17 |
-
|
| 18 |
with gr.Column(elem_id="test_nav_container", visible=False) as test_nav_container:
|
| 19 |
create_sub_navigation_bar(test_tag_map, CATEGORY_NAME)
|
| 20 |
# --- This page now has two main sections: Validation and Test ---
|
|
|
|
| 3 |
|
| 4 |
# Import our UI factories and the data loader
|
| 5 |
from ui_components import create_leaderboard_display, create_benchmark_details_display, get_full_leaderboard_data, create_sub_navigation_bar
|
| 6 |
+
from content import DATA_ANALYSIS_DESCRIPTION
|
| 7 |
# Define the category for this page
|
| 8 |
CATEGORY_NAME = "Data Analysis"
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
+
gr.Markdown(f"## Astabench{CATEGORY_NAME} Leaderboard")
|
| 12 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 13 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 14 |
+
gr.Markdown(DATA_ANALYSIS_DESCRIPTION, elem_id="category-intro")
|
| 15 |
with gr.Column(elem_id="validation_nav_container", visible=True) as validation_nav_container:
|
| 16 |
create_sub_navigation_bar(validation_tag_map, CATEGORY_NAME)
|
|
|
|
| 17 |
with gr.Column(elem_id="test_nav_container", visible=False) as test_nav_container:
|
| 18 |
create_sub_navigation_bar(test_tag_map, CATEGORY_NAME)
|
| 19 |
# --- This page now has two main sections: Validation and Test ---
|
e2e.py
CHANGED
|
@@ -3,18 +3,17 @@ import pandas as pd
|
|
| 3 |
|
| 4 |
# Import our UI factories and the data loader
|
| 5 |
from ui_components import create_leaderboard_display, create_benchmark_details_display, get_full_leaderboard_data, create_sub_navigation_bar
|
| 6 |
-
from content import
|
| 7 |
# Define the category for this page
|
| 8 |
CATEGORY_NAME = "Discovery"
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
-
gr.Markdown(f"## {CATEGORY_NAME}
|
| 12 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 13 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 14 |
-
gr.Markdown(
|
| 15 |
with gr.Column(elem_id="validation_nav_container", visible=True) as validation_nav_container:
|
| 16 |
create_sub_navigation_bar(validation_tag_map, CATEGORY_NAME)
|
| 17 |
-
|
| 18 |
with gr.Column(elem_id="test_nav_container", visible=False) as test_nav_container:
|
| 19 |
create_sub_navigation_bar(test_tag_map, CATEGORY_NAME)
|
| 20 |
# --- This page now has two main sections: Validation and Test ---
|
|
|
|
| 3 |
|
| 4 |
# Import our UI factories and the data loader
|
| 5 |
from ui_components import create_leaderboard_display, create_benchmark_details_display, get_full_leaderboard_data, create_sub_navigation_bar
|
| 6 |
+
from content import DISCOVERY_DESCRIPTION
|
| 7 |
# Define the category for this page
|
| 8 |
CATEGORY_NAME = "Discovery"
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
+
gr.Markdown(f"## Astabench{CATEGORY_NAME} Leaderboard")
|
| 12 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 13 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 14 |
+
gr.Markdown(DISCOVERY_DESCRIPTION, elem_id="category-intro")
|
| 15 |
with gr.Column(elem_id="validation_nav_container", visible=True) as validation_nav_container:
|
| 16 |
create_sub_navigation_bar(validation_tag_map, CATEGORY_NAME)
|
|
|
|
| 17 |
with gr.Column(elem_id="test_nav_container", visible=False) as test_nav_container:
|
| 18 |
create_sub_navigation_bar(test_tag_map, CATEGORY_NAME)
|
| 19 |
# --- This page now has two main sections: Validation and Test ---
|
leaderboard_transformer.py
CHANGED
|
@@ -23,6 +23,7 @@ INFORMAL_TO_FORMAL_NAME_MAP = {
|
|
| 23 |
"core_bench_validation": "Core Bench Validation",
|
| 24 |
"ds1000_validation": "DS1000 Validation",
|
| 25 |
"e2e_discovery_validation": "E2E Discovery Validation",
|
|
|
|
| 26 |
"super_validation": "Super Validation",
|
| 27 |
# Test Names
|
| 28 |
"paper_finder_test": "Paper Finder Test",
|
|
@@ -340,7 +341,7 @@ def _plot_scatter_plotly(
|
|
| 340 |
data_plot = data.copy()
|
| 341 |
data_plot[y_col_to_use] = pd.to_numeric(data_plot[y_col_to_use], errors='coerce')
|
| 342 |
|
| 343 |
-
x_axis_label = f"{x} (USD)" if x else "Cost (Data N/A)"
|
| 344 |
x_data_is_valid = False
|
| 345 |
if x and x in data_plot.columns:
|
| 346 |
try:
|
|
@@ -508,7 +509,7 @@ def format_cost_column(df: pd.DataFrame, cost_col_name: str) -> pd.DataFrame:
|
|
| 508 |
elif pd.notna(score_value):
|
| 509 |
return f'<span style="color: {status_color};">Missing</span>' # Score exists, but cost is missing
|
| 510 |
else:
|
| 511 |
-
return f'<span style="color: {status_color};">Not
|
| 512 |
|
| 513 |
# Apply the logic to the specified cost column and update the DataFrame
|
| 514 |
df[cost_col_name] = df.apply(apply_formatting_logic, axis=1)
|
|
|
|
| 23 |
"core_bench_validation": "Core Bench Validation",
|
| 24 |
"ds1000_validation": "DS1000 Validation",
|
| 25 |
"e2e_discovery_validation": "E2E Discovery Validation",
|
| 26 |
+
"e2e_discovery_hard_validation": "E2E Discovery Hard Validation",
|
| 27 |
"super_validation": "Super Validation",
|
| 28 |
# Test Names
|
| 29 |
"paper_finder_test": "Paper Finder Test",
|
|
|
|
| 341 |
data_plot = data.copy()
|
| 342 |
data_plot[y_col_to_use] = pd.to_numeric(data_plot[y_col_to_use], errors='coerce')
|
| 343 |
|
| 344 |
+
x_axis_label = f"{x} per task (USD)" if x else "Cost (Data N/A)"
|
| 345 |
x_data_is_valid = False
|
| 346 |
if x and x in data_plot.columns:
|
| 347 |
try:
|
|
|
|
| 509 |
elif pd.notna(score_value):
|
| 510 |
return f'<span style="color: {status_color};">Missing</span>' # Score exists, but cost is missing
|
| 511 |
else:
|
| 512 |
+
return f'<span style="color: {status_color};">Not Submitted</span>' # Neither score nor cost exists
|
| 513 |
|
| 514 |
# Apply the logic to the specified cost column and update the DataFrame
|
| 515 |
df[cost_col_name] = df.apply(apply_formatting_logic, axis=1)
|
literature_understanding.py
CHANGED
|
@@ -8,7 +8,7 @@ from content import LIT_DESCRIPTION
|
|
| 8 |
CATEGORY_NAME = "Literature Understanding"
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
-
gr.Markdown(f"## {CATEGORY_NAME}
|
| 12 |
|
| 13 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 14 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
|
|
|
| 8 |
CATEGORY_NAME = "Literature Understanding"
|
| 9 |
|
| 10 |
with gr.Blocks() as demo:
|
| 11 |
+
gr.Markdown(f"## Astabench{CATEGORY_NAME} Leaderboard")
|
| 12 |
|
| 13 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 14 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
main_page.py
CHANGED
|
@@ -20,10 +20,10 @@ with gr.Blocks(fill_width=True) as demo:
|
|
| 20 |
# --- Leaderboard Display Section ---
|
| 21 |
gr.Markdown("---")
|
| 22 |
CATEGORY_NAME = "Overall"
|
| 23 |
-
gr.Markdown(f"## {CATEGORY_NAME}
|
| 24 |
|
| 25 |
with gr.Tabs() as tabs:
|
| 26 |
-
with gr.Tab("Results: Validation"):
|
| 27 |
# 1. Load all necessary data for the "validation" split ONCE.
|
| 28 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 29 |
|
|
@@ -39,7 +39,7 @@ with gr.Blocks(fill_width=True) as demo:
|
|
| 39 |
else:
|
| 40 |
gr.Markdown("No data available for validation split.")
|
| 41 |
|
| 42 |
-
with gr.Tab("Results: Test"):
|
| 43 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 44 |
if not test_df.empty:
|
| 45 |
create_leaderboard_display(
|
|
@@ -55,5 +55,12 @@ with gr.Blocks(fill_width=True) as demo:
|
|
| 55 |
gr.Textbox(value=CITATION_BUTTON_TEXT, label=CITATION_BUTTON_LABEL, elem_id="citation-button-main", interactive=False)
|
| 56 |
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
if __name__ == "__main__":
|
| 59 |
demo.launch()
|
|
|
|
| 20 |
# --- Leaderboard Display Section ---
|
| 21 |
gr.Markdown("---")
|
| 22 |
CATEGORY_NAME = "Overall"
|
| 23 |
+
gr.Markdown(f"## Astabench {CATEGORY_NAME} Leaderboard")
|
| 24 |
|
| 25 |
with gr.Tabs() as tabs:
|
| 26 |
+
with gr.Tab("Results: Validation") as validation_tab:
|
| 27 |
# 1. Load all necessary data for the "validation" split ONCE.
|
| 28 |
validation_df, validation_tag_map = get_full_leaderboard_data("validation")
|
| 29 |
|
|
|
|
| 39 |
else:
|
| 40 |
gr.Markdown("No data available for validation split.")
|
| 41 |
|
| 42 |
+
with gr.Tab("Results: Test") as test_tab:
|
| 43 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 44 |
if not test_df.empty:
|
| 45 |
create_leaderboard_display(
|
|
|
|
| 55 |
gr.Textbox(value=CITATION_BUTTON_TEXT, label=CITATION_BUTTON_LABEL, elem_id="citation-button-main", interactive=False)
|
| 56 |
|
| 57 |
|
| 58 |
+
# JavaScript to show the TEST nav, hide the VALIDATION nav, AND fix the plots.
|
| 59 |
+
show_test_js = """
|
| 60 |
+
() => {setTimeout(() => { window.dispatchEvent(new Event('resize')) }, 0);}
|
| 61 |
+
"""
|
| 62 |
+
# Assign the pure JS functions to the select events. No Python `fn` is needed.
|
| 63 |
+
test_tab.select(fn=None, inputs=None, outputs=None, js=show_test_js)
|
| 64 |
+
|
| 65 |
if __name__ == "__main__":
|
| 66 |
demo.launch()
|
ui_components.py
CHANGED
|
@@ -194,7 +194,7 @@ def create_leaderboard_display(
|
|
| 194 |
gr.HTML(SCATTER_DISCLAIMER, elem_id="scatter-disclaimer")
|
| 195 |
|
| 196 |
# Put table and key into an accordion
|
| 197 |
-
with gr.Accordion("
|
| 198 |
dataframe_component = gr.DataFrame(
|
| 199 |
headers=df_headers,
|
| 200 |
value=df_view,
|
|
@@ -244,7 +244,7 @@ def create_gradio_anchor_id(text: str) -> str:
|
|
| 244 |
text = text.lower()
|
| 245 |
text = re.sub(r'\s+', '-', text) # Replace spaces with hyphens
|
| 246 |
text = re.sub(r'[^\w-]', '', text) # Remove non-word characters
|
| 247 |
-
return f"h-{text}"
|
| 248 |
def create_sub_navigation_bar(tag_map: dict, category_name: str):
|
| 249 |
"""
|
| 250 |
Generates and renders the HTML for the anchor-link sub-navigation bar.
|
|
@@ -290,7 +290,7 @@ def create_benchmark_details_display(
|
|
| 290 |
|
| 291 |
# 2. Loop through each benchmark and create its UI components
|
| 292 |
for benchmark_name in benchmark_names:
|
| 293 |
-
gr.Markdown(f"### {benchmark_name}", header_links=True)
|
| 294 |
|
| 295 |
# 3. Prepare the data for this specific benchmark's table and plot
|
| 296 |
benchmark_score_col = f"{benchmark_name} Score"
|
|
@@ -382,7 +382,7 @@ def create_benchmark_details_display(
|
|
| 382 |
gr.Plot(value=benchmark_plot)
|
| 383 |
gr.HTML(SCATTER_DISCLAIMER, elem_id="scatter-disclaimer")
|
| 384 |
# Put table and key into an accordion
|
| 385 |
-
with gr.Accordion("
|
| 386 |
gr.DataFrame(
|
| 387 |
headers=df_headers,
|
| 388 |
value=benchmark_table_df,
|
|
|
|
| 194 |
gr.HTML(SCATTER_DISCLAIMER, elem_id="scatter-disclaimer")
|
| 195 |
|
| 196 |
# Put table and key into an accordion
|
| 197 |
+
with gr.Accordion("Details", open=True, elem_id="leaderboard-accordion"):
|
| 198 |
dataframe_component = gr.DataFrame(
|
| 199 |
headers=df_headers,
|
| 200 |
value=df_view,
|
|
|
|
| 244 |
text = text.lower()
|
| 245 |
text = re.sub(r'\s+', '-', text) # Replace spaces with hyphens
|
| 246 |
text = re.sub(r'[^\w-]', '', text) # Remove non-word characters
|
| 247 |
+
return f"h-{text}-leaderboard"
|
| 248 |
def create_sub_navigation_bar(tag_map: dict, category_name: str):
|
| 249 |
"""
|
| 250 |
Generates and renders the HTML for the anchor-link sub-navigation bar.
|
|
|
|
| 290 |
|
| 291 |
# 2. Loop through each benchmark and create its UI components
|
| 292 |
for benchmark_name in benchmark_names:
|
| 293 |
+
gr.Markdown(f"### {benchmark_name} Leaderboard", header_links=True)
|
| 294 |
|
| 295 |
# 3. Prepare the data for this specific benchmark's table and plot
|
| 296 |
benchmark_score_col = f"{benchmark_name} Score"
|
|
|
|
| 382 |
gr.Plot(value=benchmark_plot)
|
| 383 |
gr.HTML(SCATTER_DISCLAIMER, elem_id="scatter-disclaimer")
|
| 384 |
# Put table and key into an accordion
|
| 385 |
+
with gr.Accordion("Details", open=True, elem_id="leaderboard-accordion"):
|
| 386 |
gr.DataFrame(
|
| 387 |
headers=df_headers,
|
| 388 |
value=benchmark_table_df,
|