Spaces:
Build error
Build error
fix
Browse files- open_pr.py +1 -10
open_pr.py
CHANGED
|
@@ -57,16 +57,7 @@ def open_pr(space_id_or_url: str, oauth_token: gr.OAuthToken | None) -> str:
|
|
| 57 |
RepoUrl(space_id_or_url).repo_id if "https://huggingface.co/spaces/" in space_id_or_url else space_id_or_url
|
| 58 |
)
|
| 59 |
|
| 60 |
-
# 0. Check
|
| 61 |
-
try:
|
| 62 |
-
user = api.whoami()
|
| 63 |
-
if user["type"] != "user":
|
| 64 |
-
raise gr.Error(
|
| 65 |
-
"You must use a user token, not an organization token. Go to https://huggingface.co/settings/token to create a new token."
|
| 66 |
-
)
|
| 67 |
-
except Exception as e:
|
| 68 |
-
raise gr.Error("Invalid token: {e}") from e
|
| 69 |
-
|
| 70 |
if not api.repo_exists(space_id, repo_type="space"):
|
| 71 |
raise gr.Error(f"Space does not exist: 'https://huggingface.co/spaces/{space_id}'.")
|
| 72 |
|
|
|
|
| 57 |
RepoUrl(space_id_or_url).repo_id if "https://huggingface.co/spaces/" in space_id_or_url else space_id_or_url
|
| 58 |
)
|
| 59 |
|
| 60 |
+
# 0. Check repo existence
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
if not api.repo_exists(space_id, repo_type="space"):
|
| 62 |
raise gr.Error(f"Space does not exist: 'https://huggingface.co/spaces/{space_id}'.")
|
| 63 |
|