pufanyi commited on
Commit
d9f262c
1 Parent(s): 4c839ed

Refactor get_leaderboard_df to handle multiple subsets and improve column selection and hiding

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. src/populate.py +6 -6
app.py CHANGED
@@ -64,7 +64,7 @@ except Exception:
64
  restart_space()
65
 
66
 
67
- LEADERBOARD_DF = get_leaderboard_df(RESULTS_REPO, EVAL_RESULTS_PATH)
68
 
69
 
70
  def init_leaderboard(dataframes):
 
64
  restart_space()
65
 
66
 
67
+ LEADERBOARD_DF = get_leaderboard_df(RESULTS_REPO)
68
 
69
 
70
  def init_leaderboard(dataframes):
src/populate.py CHANGED
@@ -6,17 +6,17 @@ import pandas as pd
6
  from src.display.formatting import has_no_nan_values, make_clickable_model
7
  from src.display.utils import AutoEvalColumn, EvalQueueColumn
8
 
9
- from datasets import load_dataset
10
 
11
 
12
- def get_leaderboard_df(results_repo, results_path):
13
- subsets = load_dataset(results_repo, split='all', cache_dir=results_path)
14
  subset_dfs = {}
15
- print("Subsets:", subsets)
16
- for subset_name, subset_data in subsets.items():
17
  subset_df = subset_data.to_pandas()
18
  subset_df = subset_df.sort_values(by="Total", ascending=False)
19
  subset_df = subset_df.round(2) # Round all numeric columns to two decimal places
20
  print(subset_df)
21
- subset_dfs[subset_name] = subset_df
22
  return subset_dfs
 
6
  from src.display.formatting import has_no_nan_values, make_clickable_model
7
  from src.display.utils import AutoEvalColumn, EvalQueueColumn
8
 
9
+ from datasets import load_dataset, get_dataset_config_names
10
 
11
 
12
+ def get_leaderboard_df(results_repo):
13
+ subsets = get_dataset_config_names(results_repo)
14
  subset_dfs = {}
15
+ for subset in subsets:
16
+ subset_data = load_dataset(results_repo, subset)
17
  subset_df = subset_data.to_pandas()
18
  subset_df = subset_df.sort_values(by="Total", ascending=False)
19
  subset_df = subset_df.round(2) # Round all numeric columns to two decimal places
20
  print(subset_df)
21
+ subset_dfs[subset] = subset_df
22
  return subset_dfs