import json import os import pandas as pd from src.display.formatting import has_no_nan_values, make_clickable_model from src.display.utils import AutoEvalColumn, EvalQueueColumn from datasets import load_dataset, get_dataset_config_names def get_leaderboard_df(results_repo): subsets = get_dataset_config_names(results_repo) subset_dfs = {} for subset in subsets: subset_data = load_dataset(results_repo, subset, split="test") subset_df = subset_data.to_pandas() subset_df = subset_df.sort_values(by="Total", ascending=False) subset_df = subset_df.round(2) # Round all numeric columns to two decimal places # subset_df["Dataset Version"] = [subset] * len(subset_df) print(subset_df) subset_dfs[subset] = subset_df # df = pd.concat(subset_dfs.values()) # return df, subset_dfs.keys() return subset_dfs