Spaces:
Sleeping
Sleeping
shyuli commited on
Commit ·
fb4956b
1
Parent(s): 55ae024
version v0.1
Browse files- src/populate.py +12 -1
src/populate.py
CHANGED
|
@@ -14,6 +14,7 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
| 14 |
all_data_json = [v.to_dict() for v in raw_data]
|
| 15 |
|
| 16 |
df = pd.DataFrame.from_records(all_data_json)
|
|
|
|
| 17 |
|
| 18 |
if df.empty:
|
| 19 |
return pd.DataFrame(columns=cols)
|
|
@@ -40,7 +41,17 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
| 40 |
df = df[cols].round(decimals=2)
|
| 41 |
|
| 42 |
# filter out if any of the benchmarks have not been produced
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
return df.reset_index(drop=True)
|
| 45 |
|
| 46 |
|
|
|
|
| 14 |
all_data_json = [v.to_dict() for v in raw_data]
|
| 15 |
|
| 16 |
df = pd.DataFrame.from_records(all_data_json)
|
| 17 |
+
present_benchmark_cols = [col for col in benchmark_cols if col in df.columns]
|
| 18 |
|
| 19 |
if df.empty:
|
| 20 |
return pd.DataFrame(columns=cols)
|
|
|
|
| 41 |
df = df[cols].round(decimals=2)
|
| 42 |
|
| 43 |
# filter out if any of the benchmarks have not been produced
|
| 44 |
+
if present_benchmark_cols:
|
| 45 |
+
df = df[has_no_nan_values(df, present_benchmark_cols)]
|
| 46 |
+
|
| 47 |
+
if df.empty:
|
| 48 |
+
placeholder_df = pd.DataFrame(columns=cols)
|
| 49 |
+
placeholder_df.loc[0] = {column: pd.NA for column in cols}
|
| 50 |
+
placeholder_df.loc[0, rank_col] = "-"
|
| 51 |
+
placeholder_df.loc[0, AutoEvalColumn.model.name] = "No completed evaluations yet"
|
| 52 |
+
placeholder_df.loc[0, average_col] = pd.NA
|
| 53 |
+
return placeholder_df
|
| 54 |
+
|
| 55 |
return df.reset_index(drop=True)
|
| 56 |
|
| 57 |
|