Abhishek Thakur
commited on
Commit
·
2331047
1
Parent(s):
31bac3c
fix creator
Browse files- competitions/create.py +4 -5
competitions/create.py
CHANGED
|
@@ -86,14 +86,13 @@ def check_if_user_can_create_competition(user_token):
|
|
| 86 |
:param user_token: the user's token
|
| 87 |
:return: True if the user can create a competition, False otherwise
|
| 88 |
"""
|
| 89 |
-
user_info = token_information(user_token, return_raw=True)
|
| 90 |
return_msg = None
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
| 92 |
return_msg = "Invalid token. You can find your HF token here: https://huggingface.co/settings/tokens"
|
| 93 |
|
| 94 |
-
elif user_info["auth"]["accessToken"]["role"] not in ("write", "fineGrained"):
|
| 95 |
-
return_msg = "Please provide a token with write access"
|
| 96 |
-
|
| 97 |
if return_msg is not None:
|
| 98 |
return gr.Dropdown()
|
| 99 |
|
|
|
|
| 86 |
:param user_token: the user's token
|
| 87 |
:return: True if the user can create a competition, False otherwise
|
| 88 |
"""
|
|
|
|
| 89 |
return_msg = None
|
| 90 |
+
try:
|
| 91 |
+
user_info = token_information(user_token)
|
| 92 |
+
except Exception as e:
|
| 93 |
+
logger.error(e)
|
| 94 |
return_msg = "Invalid token. You can find your HF token here: https://huggingface.co/settings/tokens"
|
| 95 |
|
|
|
|
|
|
|
|
|
|
| 96 |
if return_msg is not None:
|
| 97 |
return gr.Dropdown()
|
| 98 |
|