Spaces:
Sleeping
Sleeping
leandro
commited on
Commit
·
fd4b9f6
1
Parent(s):
a973bda
edge cases
Browse files
app.py
CHANGED
@@ -45,6 +45,10 @@ def create_user_summary(user_name):
|
|
45 |
|
46 |
df_user = df.loc[df["author"]==user_name]
|
47 |
|
|
|
|
|
|
|
|
|
48 |
r = requests.get(f'https://huggingface.co/api/users/{user_name}/likes')
|
49 |
user_datasets = list_datasets(author=user_name)
|
50 |
user_spaces = list_spaces(author=user_name)
|
@@ -66,7 +70,7 @@ def create_user_summary(user_name):
|
|
66 |
|
67 |
summary["repos_datasets_total"] = len(list(iter(user_datasets)))
|
68 |
summary["repos_spaces_total"] = len(list(iter(user_spaces)))
|
69 |
-
summary["repos_spaces_fav_sdk"] = Counter([info
|
70 |
|
71 |
return dict_to_html(summary)
|
72 |
|
|
|
45 |
|
46 |
df_user = df.loc[df["author"]==user_name]
|
47 |
|
48 |
+
if len(df_user) == 0:
|
49 |
+
return """<br><p style="text-align: center;color: rgb(255, 210, 31);font-family: 'Consolas', monospace; font-size: 24px;">Unfortunately there is not enough data for your report.</p><br>"""
|
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)
|
|
|
70 |
|
71 |
summary["repos_datasets_total"] = len(list(iter(user_datasets)))
|
72 |
summary["repos_spaces_total"] = len(list(iter(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)
|
76 |
|