Weyaxi commited on
Commit
2ccf9b0
1 Parent(s): 1840d1a

Defaulting the leaderboard-pr-bot (#8)

Browse files

- Defaulting the leaderboard-pr-bot (7121331ff2892fd4530a9ccc97ea01589dc98e0b)
- elif instead of if (c061bf0c8adf91f764e40e49922c01e8e608e23d)
- else token (115252e9afacd4fb371f1aca2ef113405275df9c)
- else token 2 (b68181a8f67bcd27cdb3571c83551271bea98a57)

Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -177,10 +177,12 @@ def get_edited_yaml_readme(repo, token: str | None):
177
 
178
  def commit(repo, pr_number=None, message="Adding Evaluation Results", oauth_token: gr.OAuthToken | None = None): # specify pr number if you want to edit it, don't if you don't want
179
  if oauth_token is None:
180
- raise gr.Error("You must be logged in to open a PR. Click on 'Sign in with Huggingface' first.")
181
- if oauth_token.expires_at < time.time():
 
182
  raise gr.Error("Token expired. Logout and try again.")
183
- token = oauth_token.token
 
184
 
185
  if repo.startswith("https://huggingface.co/"):
186
  try:
 
177
 
178
  def commit(repo, pr_number=None, message="Adding Evaluation Results", oauth_token: gr.OAuthToken | None = None): # specify pr number if you want to edit it, don't if you don't want
179
  if oauth_token is None:
180
+ gr.Warning("You are not logged in; therefore, the leaderboard-pr-bot will open the pull request instead of you. Click on 'Sign in with Huggingface' to log in.")
181
+ token = BOT_HF_TOKEN
182
+ elif oauth_token.expires_at < time.time():
183
  raise gr.Error("Token expired. Logout and try again.")
184
+ else:
185
+ token = oauth_token.token
186
 
187
  if repo.startswith("https://huggingface.co/"):
188
  try: