Spaces:
Running
Running
Sync main_page.py from kosmonautical/openhands-index-paul
#21
by juan-all-hands - opened
- main_page.py +88 -81
main_page.py
CHANGED
|
@@ -54,107 +54,114 @@ def filter_complete_entries(df: pd.DataFrame) -> pd.DataFrame:
|
|
| 54 |
|
| 55 |
|
| 56 |
def build_page():
|
| 57 |
-
with gr.
|
| 58 |
-
with gr.
|
| 59 |
-
gr.
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
if not test_df.empty:
|
| 68 |
-
show_incomplete_checkbox, show_open_only_checkbox, mark_by_dropdown = create_leaderboard_display(
|
| 69 |
-
full_df=test_df,
|
| 70 |
-
tag_map=test_tag_map,
|
| 71 |
-
category_name=CATEGORY_NAME,
|
| 72 |
-
split_name="test"
|
| 73 |
)
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
else:
|
| 81 |
-
test_df_open = test_df.copy()
|
| 82 |
-
test_df_complete_open = filter_complete_entries(test_df_open)
|
| 83 |
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
-
|
| 87 |
-
gr.Markdown("---")
|
| 88 |
-
gr.HTML('<h2>Winners by Category</h2>', elem_id="winners-header")
|
| 89 |
-
gr.Markdown("Top 5 performing systems in each benchmark category.")
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
elem_id="winners-
|
| 94 |
-
|
| 95 |
|
| 96 |
-
|
| 97 |
-
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
gr.Markdown("Track how model performance has improved over time based on release dates.")
|
| 102 |
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
)
|
| 107 |
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
|
| 111 |
-
gr.HTML('<h2>Open Model Accuracy by Size</h2>', elem_id="size-accuracy-header")
|
| 112 |
-
gr.Markdown("Compare open-weights model performance against their parameter count.")
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
)
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
winners_df = base_df_open if show_open_only else base_df
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
|
|
|
|
|
|
|
| 130 |
|
| 131 |
-
|
| 132 |
-
show_open_only_input = show_open_only_checkbox if show_open_only_checkbox is not None else gr.State(value=False)
|
| 133 |
-
extra_section_inputs = [show_incomplete_input, show_open_only_input, mark_by_dropdown]
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
fn=update_extra_sections,
|
| 138 |
-
inputs=extra_section_inputs,
|
| 139 |
-
outputs=[winners_component, evolution_component, size_component]
|
| 140 |
)
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
show_open_only_checkbox.change(
|
| 144 |
-
fn=update_extra_sections,
|
| 145 |
-
inputs=extra_section_inputs,
|
| 146 |
-
outputs=[winners_component, evolution_component, size_component]
|
| 147 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
fn=update_extra_sections,
|
| 152 |
-
inputs=extra_section_inputs,
|
| 153 |
-
outputs=[winners_component, evolution_component, size_component]
|
| 154 |
-
)
|
| 155 |
-
|
| 156 |
-
else:
|
| 157 |
-
gr.Markdown("No data available.")
|
| 158 |
|
| 159 |
if __name__ == "__main__":
|
| 160 |
demo.launch()
|
|
|
|
| 54 |
|
| 55 |
|
| 56 |
def build_page():
|
| 57 |
+
with gr.Column(elem_id="page-content-wrapper"):
|
| 58 |
+
with gr.Row(elem_id="intro-row"):
|
| 59 |
+
with gr.Column(scale=1):
|
| 60 |
+
gr.HTML(INTRO_PARAGRAPH, elem_id="intro-paragraph")
|
| 61 |
+
|
| 62 |
+
# --- Leaderboard Display Section ---
|
| 63 |
+
CATEGORY_NAME = "Overall"
|
| 64 |
+
gr.HTML(
|
| 65 |
+
f'<h2>OpenHands Index {CATEGORY_NAME} Leaderboard <span style="font-weight: normal; color: inherit;">(Aggregate)</span></h2>',
|
| 66 |
+
elem_id="main-header",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
)
|
| 68 |
|
| 69 |
+
test_df, test_tag_map = get_full_leaderboard_data("test")
|
| 70 |
+
if not test_df.empty:
|
| 71 |
+
show_incomplete_checkbox, show_open_only_checkbox, mark_by_dropdown = create_leaderboard_display(
|
| 72 |
+
full_df=test_df,
|
| 73 |
+
tag_map=test_tag_map,
|
| 74 |
+
category_name=CATEGORY_NAME,
|
| 75 |
+
split_name="test",
|
| 76 |
+
)
|
| 77 |
|
| 78 |
+
test_df_complete = filter_complete_entries(test_df)
|
| 79 |
+
has_complete_entries = len(test_df_complete) > 0
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
+
if "Openness" in test_df.columns:
|
| 82 |
+
test_df_open = test_df[test_df["Openness"].str.lower() == "open"].copy()
|
| 83 |
+
else:
|
| 84 |
+
test_df_open = test_df.copy()
|
| 85 |
+
test_df_complete_open = filter_complete_entries(test_df_open)
|
| 86 |
|
| 87 |
+
initial_df = test_df_complete if has_complete_entries else test_df
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
+
# --- Winners by Category Section ---
|
| 90 |
+
gr.Markdown("---")
|
| 91 |
+
gr.HTML('<h2>Winners by Category</h2>', elem_id="winners-header")
|
| 92 |
+
gr.Markdown("Top 5 performing systems in each benchmark category.")
|
| 93 |
|
| 94 |
+
winners_component = gr.HTML(
|
| 95 |
+
create_winners_by_category_html(initial_df, top_n=5),
|
| 96 |
+
elem_id="winners-by-category",
|
| 97 |
+
)
|
| 98 |
|
| 99 |
+
# --- New Visualization Sections ---
|
| 100 |
+
gr.Markdown("---")
|
|
|
|
| 101 |
|
| 102 |
+
# Evolution Over Time Section
|
| 103 |
+
gr.HTML('<h2>Evolution Over Time</h2>', elem_id="evolution-header")
|
| 104 |
+
gr.Markdown("Track how model performance has improved over time based on release dates.")
|
|
|
|
| 105 |
|
| 106 |
+
evolution_component = gr.Plot(
|
| 107 |
+
value=create_evolution_over_time_chart(initial_df, MARK_BY_DEFAULT),
|
| 108 |
+
elem_id="evolution-chart",
|
| 109 |
+
)
|
| 110 |
|
| 111 |
+
gr.Markdown("---")
|
|
|
|
|
|
|
| 112 |
|
| 113 |
+
# Open Model Accuracy by Size Section (always shows open models only by design)
|
| 114 |
+
gr.HTML('<h2>Open Model Accuracy by Size</h2>', elem_id="size-accuracy-header")
|
| 115 |
+
gr.Markdown("Compare open-weights model performance against their parameter count.")
|
|
|
|
| 116 |
|
| 117 |
+
size_component = gr.Plot(
|
| 118 |
+
value=create_accuracy_by_size_chart(initial_df, MARK_BY_DEFAULT),
|
| 119 |
+
elem_id="size-accuracy-chart",
|
| 120 |
+
)
|
|
|
|
| 121 |
|
| 122 |
+
def update_extra_sections(show_incomplete, show_open_only, mark_by):
|
| 123 |
+
include_incomplete = show_incomplete or not has_complete_entries
|
| 124 |
+
base_df = test_df if include_incomplete else test_df_complete
|
| 125 |
+
base_df_open = test_df_open if include_incomplete else test_df_complete_open
|
| 126 |
+
winners_df = base_df_open if show_open_only else base_df
|
| 127 |
|
| 128 |
+
winners_html = create_winners_by_category_html(winners_df, top_n=5)
|
| 129 |
+
evolution_fig = create_evolution_over_time_chart(winners_df, mark_by)
|
| 130 |
+
size_fig = create_accuracy_by_size_chart(base_df, mark_by)
|
| 131 |
|
| 132 |
+
return winners_html, evolution_fig, size_fig
|
|
|
|
|
|
|
| 133 |
|
| 134 |
+
show_incomplete_input = (
|
| 135 |
+
show_incomplete_checkbox if show_incomplete_checkbox is not None else gr.State(value=True)
|
|
|
|
|
|
|
|
|
|
| 136 |
)
|
| 137 |
+
show_open_only_input = (
|
| 138 |
+
show_open_only_checkbox if show_open_only_checkbox is not None else gr.State(value=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
)
|
| 140 |
+
extra_section_inputs = [show_incomplete_input, show_open_only_input, mark_by_dropdown]
|
| 141 |
+
|
| 142 |
+
if show_incomplete_checkbox is not None:
|
| 143 |
+
show_incomplete_checkbox.change(
|
| 144 |
+
fn=update_extra_sections,
|
| 145 |
+
inputs=extra_section_inputs,
|
| 146 |
+
outputs=[winners_component, evolution_component, size_component],
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
if show_open_only_checkbox is not None:
|
| 150 |
+
show_open_only_checkbox.change(
|
| 151 |
+
fn=update_extra_sections,
|
| 152 |
+
inputs=extra_section_inputs,
|
| 153 |
+
outputs=[winners_component, evolution_component, size_component],
|
| 154 |
+
)
|
| 155 |
+
|
| 156 |
+
if mark_by_dropdown is not None:
|
| 157 |
+
mark_by_dropdown.change(
|
| 158 |
+
fn=update_extra_sections,
|
| 159 |
+
inputs=extra_section_inputs,
|
| 160 |
+
outputs=[winners_component, evolution_component, size_component],
|
| 161 |
+
)
|
| 162 |
|
| 163 |
+
else:
|
| 164 |
+
gr.Markdown("No data available.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
if __name__ == "__main__":
|
| 167 |
demo.launch()
|