ngxson HF staff commited on
Commit
feea605
·
verified ·
1 Parent(s): 7f7fd49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -86,8 +86,12 @@ def guess_base_model(ft_model_id):
86
 
87
 
88
  def process_model(ft_model_id: str, base_model_id: str, rank: str, private_repo, oauth_token: gr.OAuthToken | None):
89
- if oauth_token is None or oauth_token.token is None:
 
 
 
90
  raise gr.Error("You must be logged in")
 
91
  model_name = ft_model_id.split('/')[-1]
92
 
93
  # validate the oauth token
 
86
 
87
 
88
  def process_model(ft_model_id: str, base_model_id: str, rank: str, private_repo, oauth_token: gr.OAuthToken | None):
89
+ # validate the oauth token
90
+ try:
91
+ whoami(oauth_token.token)
92
+ except Exception as e:
93
  raise gr.Error("You must be logged in")
94
+
95
  model_name = ft_model_id.split('/')[-1]
96
 
97
  # validate the oauth token