style theme
Browse files
app.py
CHANGED
@@ -276,24 +276,10 @@ def init_leaderboard(dataframe, visible_columns=None):
|
|
276 |
# Avoid rounding integer columns like counts
|
277 |
if not pd.api.types.is_integer_dtype(display_df[col]):
|
278 |
# Format floats to exactly 3 decimal places, preserving trailing zeros
|
279 |
-
|
280 |
-
pass # Formatting will be handled by Styler
|
281 |
-
|
282 |
-
# Create Styler object for formatting and alignment
|
283 |
-
styler = display_df.style
|
284 |
-
|
285 |
-
# Format numeric columns to 3 decimal places
|
286 |
-
format_dict = {}
|
287 |
-
for col in numeric_cols:
|
288 |
-
if not pd.api.types.is_integer_dtype(display_df[col]):
|
289 |
-
format_dict[col] = "{:.3f}"
|
290 |
-
styler = styler.format(format_dict, na_rep="") # Use empty string for NaNs
|
291 |
-
|
292 |
-
# Right-align all columns (Gradio might do this for numbers, but explicit is better)
|
293 |
-
styler = styler.set_properties(**{'text-align': 'right'})
|
294 |
|
295 |
return gr.Dataframe(
|
296 |
-
value=
|
297 |
headers=visible_columns,
|
298 |
datatype=datatypes, # Now using the correct format
|
299 |
interactive=False,
|
@@ -608,7 +594,8 @@ with demo:
|
|
608 |
value=CURRENT_VERSION,
|
609 |
interactive=True,
|
610 |
elem_classes="version-selector",
|
611 |
-
scale=1
|
|
|
612 |
)
|
613 |
|
614 |
with gr.Row():
|
@@ -748,7 +735,8 @@ with demo:
|
|
748 |
choices=BENCHMARK_VERSIONS,
|
749 |
label="Benchmark Version",
|
750 |
value=CURRENT_VERSION,
|
751 |
-
interactive=True
|
|
|
752 |
)
|
753 |
model_selector = gr.Dropdown(
|
754 |
choices=update_model_choices(CURRENT_VERSION),
|
@@ -805,7 +793,8 @@ with demo:
|
|
805 |
label="Benchmark Version",
|
806 |
value=CURRENT_VERSION,
|
807 |
interactive=True,
|
808 |
-
elem_classes="version-selector"
|
|
|
809 |
)
|
810 |
|
811 |
with gr.Row():
|
@@ -876,26 +865,6 @@ with demo:
|
|
876 |
outputs=[leaderboard] + [category_tabs.children[i].children[0] for i in range(1, len(CATEGORIES) + 1)]
|
877 |
)
|
878 |
|
879 |
-
# with gr.Row():
|
880 |
-
# with gr.Column():
|
881 |
-
# gr.Textbox(
|
882 |
-
# value=CITATION_BUTTON_TEXT,
|
883 |
-
# label="Cite",
|
884 |
-
# lines=8,
|
885 |
-
# elem_id="citation-button",
|
886 |
-
# show_copy_button=True,
|
887 |
-
# )
|
888 |
-
|
889 |
-
# # with gr.Accordion("Dataset Information", open=False):
|
890 |
-
# with gr.Column():
|
891 |
-
# gr.Textbox(
|
892 |
-
# value=f"""
|
893 |
-
# https://huggingface.co/datasets/{RESULTS_DATASET_ID}
|
894 |
-
|
895 |
-
# Last updated: {pd.Timestamp.now().strftime("%Y-%m-%d %H:%M:%S UTC")}
|
896 |
-
# """,
|
897 |
-
# lines=8,
|
898 |
-
# label="Results:")
|
899 |
|
900 |
# Set up the scheduler to refresh data periodically
|
901 |
scheduler = BackgroundScheduler()
|
|
|
276 |
# Avoid rounding integer columns like counts
|
277 |
if not pd.api.types.is_integer_dtype(display_df[col]):
|
278 |
# Format floats to exactly 3 decimal places, preserving trailing zeros
|
279 |
+
display_df[col] = display_df[col].apply(lambda x: f"{x:.3f}" if pd.notna(x) else None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
|
281 |
return gr.Dataframe(
|
282 |
+
value=display_df,
|
283 |
headers=visible_columns,
|
284 |
datatype=datatypes, # Now using the correct format
|
285 |
interactive=False,
|
|
|
594 |
value=CURRENT_VERSION,
|
595 |
interactive=True,
|
596 |
elem_classes="version-selector",
|
597 |
+
scale=1,
|
598 |
+
visible=False
|
599 |
)
|
600 |
|
601 |
with gr.Row():
|
|
|
735 |
choices=BENCHMARK_VERSIONS,
|
736 |
label="Benchmark Version",
|
737 |
value=CURRENT_VERSION,
|
738 |
+
interactive=True,
|
739 |
+
visible=False
|
740 |
)
|
741 |
model_selector = gr.Dropdown(
|
742 |
choices=update_model_choices(CURRENT_VERSION),
|
|
|
793 |
label="Benchmark Version",
|
794 |
value=CURRENT_VERSION,
|
795 |
interactive=True,
|
796 |
+
elem_classes="version-selector",
|
797 |
+
visible=False
|
798 |
)
|
799 |
|
800 |
with gr.Row():
|
|
|
865 |
outputs=[leaderboard] + [category_tabs.children[i].children[0] for i in range(1, len(CATEGORIES) + 1)]
|
866 |
)
|
867 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
|
869 |
# Set up the scheduler to refresh data periodically
|
870 |
scheduler = BackgroundScheduler()
|