Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,14 +6,15 @@ from typing import Union
|
|
| 6 |
|
| 7 |
# Helper function to get the total storage for models, datasets, or spaces
|
| 8 |
def get_total_storage(namespace, resource_type, oauth_token: Union[gr.OAuthToken, None]):
|
|
|
|
| 9 |
if resource_type == "model":
|
| 10 |
-
resources = list(list_models(author=namespace, token=
|
| 11 |
url_base = "https://huggingface.co/api/models"
|
| 12 |
elif resource_type == "dataset":
|
| 13 |
-
resources = list(list_datasets(author=namespace, token=
|
| 14 |
url_base = "https://huggingface.co/api/datasets"
|
| 15 |
elif resource_type == "space":
|
| 16 |
-
resources = list(list_spaces(author=namespace, token=
|
| 17 |
url_base = "https://huggingface.co/api/spaces"
|
| 18 |
|
| 19 |
total_storage = 0
|
|
|
|
| 6 |
|
| 7 |
# Helper function to get the total storage for models, datasets, or spaces
|
| 8 |
def get_total_storage(namespace, resource_type, oauth_token: Union[gr.OAuthToken, None]):
|
| 9 |
+
token = oauth_token.token if oauth_token else None
|
| 10 |
if resource_type == "model":
|
| 11 |
+
resources = list(list_models(author=namespace, token=token))
|
| 12 |
url_base = "https://huggingface.co/api/models"
|
| 13 |
elif resource_type == "dataset":
|
| 14 |
+
resources = list(list_datasets(author=namespace, token=token))
|
| 15 |
url_base = "https://huggingface.co/api/datasets"
|
| 16 |
elif resource_type == "space":
|
| 17 |
+
resources = list(list_spaces(author=namespace, token=token))
|
| 18 |
url_base = "https://huggingface.co/api/spaces"
|
| 19 |
|
| 20 |
total_storage = 0
|