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