Spaces:
Sleeping
Sleeping
Adapt `list_datasets` and `list_spaces` for future release of `huggingface_hub` (#3)
Browse files- Adapt `list_datasets` and `list_spaces` for future release of `huggingface_hub` (3d5d009bcd3a3a7fe3b758077ea350c44ac81e0d)
Co-authored-by: Lucain Pouget <[email protected]>
app.py
CHANGED
|
@@ -50,8 +50,8 @@ def create_user_summary(user_name):
|
|
| 50 |
|
| 51 |
|
| 52 |
r = requests.get(f'https://huggingface.co/api/users/{user_name}/likes')
|
| 53 |
-
user_datasets = list_datasets(author=user_name)
|
| 54 |
-
user_spaces = list_spaces(author=user_name)
|
| 55 |
|
| 56 |
summary["likes_user_total"] = df_user["likes"].sum()
|
| 57 |
summary["likes_user_given"] = len(r.json())
|
|
@@ -68,8 +68,8 @@ def create_user_summary(user_name):
|
|
| 68 |
summary["repos_model_top"] = df_ranks["repos"][df_ranks["repos"]["value"]>=summary["repos_model_total"]].iloc[0]["top_perc"]
|
| 69 |
summary["repos_model_fav_type"] = Counter(df_user["model_type"].dropna()).most_common(1)[0][0]
|
| 70 |
|
| 71 |
-
summary["repos_datasets_total"] = len(
|
| 72 |
-
summary["repos_spaces_total"] = len(
|
| 73 |
summary["repos_spaces_fav_sdk"] = Counter([getattr(info, "sdk", "n/a") for info in user_spaces]).most_common(1)[0][0]
|
| 74 |
|
| 75 |
return dict_to_html(summary)
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
r = requests.get(f'https://huggingface.co/api/users/{user_name}/likes')
|
| 53 |
+
user_datasets = [dataset for dataset in list_datasets(author=user_name)]
|
| 54 |
+
user_spaces = [space for space in list_spaces(author=user_name)]
|
| 55 |
|
| 56 |
summary["likes_user_total"] = df_user["likes"].sum()
|
| 57 |
summary["likes_user_given"] = len(r.json())
|
|
|
|
| 68 |
summary["repos_model_top"] = df_ranks["repos"][df_ranks["repos"]["value"]>=summary["repos_model_total"]].iloc[0]["top_perc"]
|
| 69 |
summary["repos_model_fav_type"] = Counter(df_user["model_type"].dropna()).most_common(1)[0][0]
|
| 70 |
|
| 71 |
+
summary["repos_datasets_total"] = len(user_datasets)
|
| 72 |
+
summary["repos_spaces_total"] = len(user_spaces)
|
| 73 |
summary["repos_spaces_fav_sdk"] = Counter([getattr(info, "sdk", "n/a") for info in user_spaces]).most_common(1)[0][0]
|
| 74 |
|
| 75 |
return dict_to_html(summary)
|