Commit
·
cd16e55
1
Parent(s):
ed90aae
Improve DataFrame handling in leaderboard functions; add debug print for empty DataFrame case
Browse files- app.py +2 -3
- src/populate.py +3 -1
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
|
3 |
-
import pandas as pd
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
from huggingface_hub import snapshot_download
|
6 |
|
@@ -58,8 +57,8 @@ LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS,
|
|
58 |
) = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
59 |
|
60 |
def init_leaderboard(dataframe):
|
61 |
-
if dataframe is None or dataframe.empty:
|
62 |
-
|
63 |
return Leaderboard(
|
64 |
value=dataframe,
|
65 |
datatype=[c.type for c in fields(AutoEvalColumn())],
|
|
|
1 |
import gradio as gr
|
2 |
from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
|
|
|
3 |
from apscheduler.schedulers.background import BackgroundScheduler
|
4 |
from huggingface_hub import snapshot_download
|
5 |
|
|
|
57 |
) = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
|
58 |
|
59 |
def init_leaderboard(dataframe):
|
60 |
+
# if dataframe is None or dataframe.empty:
|
61 |
+
# raise ValueError("Leaderboard DataFrame is empty or None.")
|
62 |
return Leaderboard(
|
63 |
value=dataframe,
|
64 |
datatype=[c.type for c in fields(AutoEvalColumn())],
|
src/populate.py
CHANGED
@@ -13,9 +13,11 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
13 |
raw_data = get_raw_eval_results(results_path, requests_path)
|
14 |
all_data_json = [v.to_dict() for v in raw_data]
|
15 |
df = pd.DataFrame.from_records(all_data_json)
|
|
|
|
|
|
|
16 |
df = df.sort_values(by=[AutoEvalColumn().average.name], ascending=False)
|
17 |
df = df[cols].round(decimals=2)
|
18 |
-
# filter out if any of the benchmarks have not been produced
|
19 |
df = df[has_no_nan_values(df, benchmark_cols)]
|
20 |
return df
|
21 |
|
|
|
13 |
raw_data = get_raw_eval_results(results_path, requests_path)
|
14 |
all_data_json = [v.to_dict() for v in raw_data]
|
15 |
df = pd.DataFrame.from_records(all_data_json)
|
16 |
+
if df.empty:
|
17 |
+
print("No evaluation results found. Returning empty DataFrame with correct columns.")
|
18 |
+
return pd.DataFrame(columns=cols)
|
19 |
df = df.sort_values(by=[AutoEvalColumn().average.name], ascending=False)
|
20 |
df = df[cols].round(decimals=2)
|
|
|
21 |
df = df[has_no_nan_values(df, benchmark_cols)]
|
22 |
return df
|
23 |
|