add modality
Browse files- graphs/leaderboard.py +5 -2
graphs/leaderboard.py
CHANGED
|
@@ -40,7 +40,7 @@ def create_leaderboard(filtered_df, country_df, developer_df, model_df, start_ti
|
|
| 40 |
).drop(columns=["metric"])
|
| 41 |
|
| 42 |
model_df = model_df.merge(
|
| 43 |
-
filtered_df[["country", "author", "downloads", "org_or_user", "model"]].drop_duplicates(subset=["model"]),
|
| 44 |
left_on="metric", right_on="model", how="left"
|
| 45 |
).drop(columns=["metric"])
|
| 46 |
|
|
@@ -71,7 +71,7 @@ def create_leaderboard(filtered_df, country_df, developer_df, model_df, start_ti
|
|
| 71 |
top["% of total"] = top["Total Value"] / total_value * 100 if total_value else 0
|
| 72 |
|
| 73 |
# All relevant metadata columns
|
| 74 |
-
meta_cols = ["country", "author", "downloads", "org_or_user"]
|
| 75 |
# Collect all metadata per top n for each category (country, author, model)
|
| 76 |
meta_map = {}
|
| 77 |
for name in top["Name"]:
|
|
@@ -104,6 +104,9 @@ def create_leaderboard(filtered_df, country_df, developer_df, model_df, start_ti
|
|
| 104 |
for d in meta.get("downloads", []):
|
| 105 |
if pd.notna(d): # Check if d is not NaN
|
| 106 |
chips.append(("⬇️", f"{int(d):,}"))
|
|
|
|
|
|
|
|
|
|
| 107 |
return chips
|
| 108 |
|
| 109 |
# Apply metadata builder to top dataframe
|
|
|
|
| 40 |
).drop(columns=["metric"])
|
| 41 |
|
| 42 |
model_df = model_df.merge(
|
| 43 |
+
filtered_df[["country", "author", "downloads", "org_or_user", "model", "merged_modality"]].drop_duplicates(subset=["model"]),
|
| 44 |
left_on="metric", right_on="model", how="left"
|
| 45 |
).drop(columns=["metric"])
|
| 46 |
|
|
|
|
| 71 |
top["% of total"] = top["Total Value"] / total_value * 100 if total_value else 0
|
| 72 |
|
| 73 |
# All relevant metadata columns
|
| 74 |
+
meta_cols = ["country", "author", "downloads", "org_or_user", "merged_modality"]
|
| 75 |
# Collect all metadata per top n for each category (country, author, model)
|
| 76 |
meta_map = {}
|
| 77 |
for name in top["Name"]:
|
|
|
|
| 104 |
for d in meta.get("downloads", []):
|
| 105 |
if pd.notna(d): # Check if d is not NaN
|
| 106 |
chips.append(("⬇️", f"{int(d):,}"))
|
| 107 |
+
# Modality
|
| 108 |
+
for m in meta.get("merged_modality", []):
|
| 109 |
+
chips.append(("", m))
|
| 110 |
return chips
|
| 111 |
|
| 112 |
# Apply metadata builder to top dataframe
|