Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
9227886
1
Parent(s):
f4416a9
Update app.py
Browse files
app.py
CHANGED
@@ -474,16 +474,15 @@ def check_token(token):
|
|
474 |
api = HfApi(token=token)
|
475 |
user_data = api.whoami()
|
476 |
except Exception as e:
|
477 |
-
raise gr.
|
478 |
else:
|
479 |
-
print(user_data)
|
480 |
if (user_data['auth']['accessToken']['role'] != "write"):
|
481 |
-
gr.
|
482 |
else:
|
483 |
if user_data['canPay']:
|
484 |
return gr.update(visible=False), gr.update(visible=True)
|
485 |
else:
|
486 |
-
gr.
|
487 |
return gr.update(visible=True), gr.update(visible=False)
|
488 |
|
489 |
return gr.update(visible=False), gr.update(visible=False)
|
|
|
474 |
api = HfApi(token=token)
|
475 |
user_data = api.whoami()
|
476 |
except Exception as e:
|
477 |
+
raise gr.Info("Invalid user token. Make sure to get your Hugging Face token from the settings page")
|
478 |
else:
|
|
|
479 |
if (user_data['auth']['accessToken']['role'] != "write"):
|
480 |
+
gr.Info("Ops, you've uploaded a `Read` token. You need to use a Write token!")
|
481 |
else:
|
482 |
if user_data['canPay']:
|
483 |
return gr.update(visible=False), gr.update(visible=True)
|
484 |
else:
|
485 |
+
gr.Info("Your payment method isn't set up. You gotta set them up to start training")
|
486 |
return gr.update(visible=True), gr.update(visible=False)
|
487 |
|
488 |
return gr.update(visible=False), gr.update(visible=False)
|