Update src/populate.py
Browse files- src/populate.py +10 -7
src/populate.py
CHANGED
@@ -43,23 +43,26 @@ def get_leaderboard_df(eval_results_path, eval_requests_path, cols, benchmark_co
|
|
43 |
df = df.sort_values(by=['average'], ascending=False)
|
44 |
|
45 |
# 🔹 Fix Column Data Types for Correct Display in Gradio
|
|
|
46 |
NUMERIC_COLUMNS = ["average", "likes", "params"] + [col for col in df.columns if col not in [
|
47 |
"model_name", "submitted_time", "base_model", "revision", "precision", "weight_type", "model_type", "license"
|
48 |
]]
|
49 |
-
|
50 |
for col in NUMERIC_COLUMNS:
|
51 |
if col in df.columns:
|
52 |
-
df[col] = pd.to_numeric(df[col], errors="coerce")
|
53 |
-
|
|
|
54 |
TEXT_COLUMNS = ["model_name", "submitted_time", "base_model", "revision", "precision", "weight_type", "model_type", "license"]
|
55 |
-
|
56 |
for col in TEXT_COLUMNS:
|
57 |
if col in df.columns:
|
58 |
df[col] = df[col].astype(str)
|
59 |
-
|
60 |
-
#
|
61 |
print("✅ LEADERBOARD_DF Updated dtypes:\n", df.dtypes)
|
62 |
-
|
|
|
63 |
return df
|
64 |
|
65 |
def get_evaluation_queue_df(eval_requests_path, eval_cols):
|
|
|
43 |
df = df.sort_values(by=['average'], ascending=False)
|
44 |
|
45 |
# 🔹 Fix Column Data Types for Correct Display in Gradio
|
46 |
+
# Ensure numeric fields are properly converted
|
47 |
NUMERIC_COLUMNS = ["average", "likes", "params"] + [col for col in df.columns if col not in [
|
48 |
"model_name", "submitted_time", "base_model", "revision", "precision", "weight_type", "model_type", "license"
|
49 |
]]
|
50 |
+
|
51 |
for col in NUMERIC_COLUMNS:
|
52 |
if col in df.columns:
|
53 |
+
df[col] = pd.to_numeric(df[col], errors="coerce") # Convert to float
|
54 |
+
|
55 |
+
# Ensure categorical/text fields are properly converted to strings
|
56 |
TEXT_COLUMNS = ["model_name", "submitted_time", "base_model", "revision", "precision", "weight_type", "model_type", "license"]
|
57 |
+
|
58 |
for col in TEXT_COLUMNS:
|
59 |
if col in df.columns:
|
60 |
df[col] = df[col].astype(str)
|
61 |
+
|
62 |
+
# Debug: Print column types
|
63 |
print("✅ LEADERBOARD_DF Updated dtypes:\n", df.dtypes)
|
64 |
+
|
65 |
+
|
66 |
return df
|
67 |
|
68 |
def get_evaluation_queue_df(eval_requests_path, eval_cols):
|