Spaces:
Running
Running
openhands
commited on
Commit
·
49f9739
1
Parent(s):
3ad0e27
Connect 'Show only open models' checkbox to Winners and Evolution sections
Browse files- Modified create_leaderboard_display to return show_open_only_checkbox
- Updated main_page.py to connect checkbox to Winners by Category and Evolution charts
- Pre-generate both all and open-only versions of Winners HTML and Evolution plot
- When checkbox is toggled, both sections now update to show only open models
- main_page.py +33 -6
- ui_components.py +2 -2
main_page.py
CHANGED
|
@@ -36,20 +36,30 @@ def build_page():
|
|
| 36 |
|
| 37 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 38 |
if not test_df.empty:
|
| 39 |
-
create_leaderboard_display
|
|
|
|
| 40 |
full_df=test_df,
|
| 41 |
tag_map=test_tag_map,
|
| 42 |
category_name=CATEGORY_NAME,
|
| 43 |
split_name="test"
|
| 44 |
)
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
# --- Winners by Category Section ---
|
| 47 |
gr.Markdown("---")
|
| 48 |
gr.HTML('<h2>Winners by Category</h2>', elem_id="winners-header")
|
| 49 |
gr.Markdown("Top 5 performing systems in each benchmark category.")
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# --- New Visualization Sections ---
|
| 55 |
gr.Markdown("---")
|
|
@@ -58,18 +68,35 @@ def build_page():
|
|
| 58 |
gr.HTML('<h2>Evolution Over Time</h2>', elem_id="evolution-header")
|
| 59 |
gr.Markdown("Track how model performance has improved over time based on release dates.")
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
gr.Markdown("---")
|
| 65 |
|
| 66 |
-
# Open Model Accuracy by Size Section
|
| 67 |
gr.HTML('<h2>Open Model Accuracy by Size</h2>', elem_id="size-accuracy-header")
|
| 68 |
gr.Markdown("Compare open-weights model performance against their parameter count. The x-axis shows active parameters (relevant for MoE models).")
|
| 69 |
|
| 70 |
size_fig = create_accuracy_by_size_chart(test_df)
|
| 71 |
gr.Plot(value=size_fig, elem_id="size-accuracy-chart")
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
else:
|
| 74 |
gr.Markdown("No data available.")
|
| 75 |
|
|
|
|
| 36 |
|
| 37 |
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 38 |
if not test_df.empty:
|
| 39 |
+
# Get the checkbox returned from create_leaderboard_display
|
| 40 |
+
show_open_only_checkbox = create_leaderboard_display(
|
| 41 |
full_df=test_df,
|
| 42 |
tag_map=test_tag_map,
|
| 43 |
category_name=CATEGORY_NAME,
|
| 44 |
split_name="test"
|
| 45 |
)
|
| 46 |
|
| 47 |
+
# Prepare open-only filtered dataframe for Winners and Evolution
|
| 48 |
+
if 'Openness' in test_df.columns:
|
| 49 |
+
test_df_open = test_df[test_df['Openness'].str.lower() == 'open'].copy()
|
| 50 |
+
else:
|
| 51 |
+
test_df_open = test_df.copy()
|
| 52 |
+
|
| 53 |
# --- Winners by Category Section ---
|
| 54 |
gr.Markdown("---")
|
| 55 |
gr.HTML('<h2>Winners by Category</h2>', elem_id="winners-header")
|
| 56 |
gr.Markdown("Top 5 performing systems in each benchmark category.")
|
| 57 |
|
| 58 |
+
# Create both all and open-only versions of winners HTML
|
| 59 |
+
winners_html_all = create_winners_by_category_html(test_df, top_n=5)
|
| 60 |
+
winners_html_open = create_winners_by_category_html(test_df_open, top_n=5)
|
| 61 |
+
|
| 62 |
+
winners_component = gr.HTML(winners_html_all, elem_id="winners-by-category")
|
| 63 |
|
| 64 |
# --- New Visualization Sections ---
|
| 65 |
gr.Markdown("---")
|
|
|
|
| 68 |
gr.HTML('<h2>Evolution Over Time</h2>', elem_id="evolution-header")
|
| 69 |
gr.Markdown("Track how model performance has improved over time based on release dates.")
|
| 70 |
|
| 71 |
+
# Create both all and open-only versions of evolution chart
|
| 72 |
+
evolution_fig_all = create_evolution_over_time_chart(test_df)
|
| 73 |
+
evolution_fig_open = create_evolution_over_time_chart(test_df_open)
|
| 74 |
+
|
| 75 |
+
evolution_component = gr.Plot(value=evolution_fig_all, elem_id="evolution-chart")
|
| 76 |
|
| 77 |
gr.Markdown("---")
|
| 78 |
|
| 79 |
+
# Open Model Accuracy by Size Section (always shows open models only by design)
|
| 80 |
gr.HTML('<h2>Open Model Accuracy by Size</h2>', elem_id="size-accuracy-header")
|
| 81 |
gr.Markdown("Compare open-weights model performance against their parameter count. The x-axis shows active parameters (relevant for MoE models).")
|
| 82 |
|
| 83 |
size_fig = create_accuracy_by_size_chart(test_df)
|
| 84 |
gr.Plot(value=size_fig, elem_id="size-accuracy-chart")
|
| 85 |
|
| 86 |
+
# Connect the open models checkbox to update Winners and Evolution sections
|
| 87 |
+
if show_open_only_checkbox is not None:
|
| 88 |
+
def update_winners_and_evolution(show_open_only):
|
| 89 |
+
if show_open_only:
|
| 90 |
+
return winners_html_open, evolution_fig_open
|
| 91 |
+
else:
|
| 92 |
+
return winners_html_all, evolution_fig_all
|
| 93 |
+
|
| 94 |
+
show_open_only_checkbox.change(
|
| 95 |
+
fn=update_winners_and_evolution,
|
| 96 |
+
inputs=[show_open_only_checkbox],
|
| 97 |
+
outputs=[winners_component, evolution_component]
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
else:
|
| 101 |
gr.Markdown("No data available.")
|
| 102 |
|
ui_components.py
CHANGED
|
@@ -1061,8 +1061,8 @@ def create_leaderboard_display(
|
|
| 1061 |
outputs=[dataframe_component, cost_plot_component, runtime_plot_component]
|
| 1062 |
)
|
| 1063 |
|
| 1064 |
-
# Return the
|
| 1065 |
-
return
|
| 1066 |
|
| 1067 |
# # --- Detailed Benchmark Display ---
|
| 1068 |
def create_benchmark_details_display(
|
|
|
|
| 1061 |
outputs=[dataframe_component, cost_plot_component, runtime_plot_component]
|
| 1062 |
)
|
| 1063 |
|
| 1064 |
+
# Return the show_open_only_checkbox so it can be used to update other sections
|
| 1065 |
+
return show_open_only_checkbox
|
| 1066 |
|
| 1067 |
# # --- Detailed Benchmark Display ---
|
| 1068 |
def create_benchmark_details_display(
|