Abhishek Thakur commited on
Commit
3df244c
·
1 Parent(s): 5f7f284

user hf token

Browse files
Files changed (1) hide show
  1. competitions/oauth.py +3 -3
competitions/oauth.py CHANGED
@@ -28,7 +28,7 @@ def attach_oauth(app: fastapi.FastAPI):
28
  # Add `/login/huggingface`, `/login/callback` and `/logout` routes to enable OAuth in the Gradio app.
29
  # If the app is running in a Space, OAuth is enabled normally. Otherwise, we mock the "real" routes to make the
30
  # user log in with a fake user profile - without any calls to hf.co.
31
- if os.environ.get("SPACE_ID") is not None and os.environ.get("HF_TOKEN") is None:
32
  _add_oauth_routes(app)
33
  else:
34
  _add_mocked_oauth_routes(app)
@@ -199,11 +199,11 @@ class OAuthToken:
199
 
200
 
201
  def _get_mocked_oauth_info() -> typing.Dict:
202
- token = os.environ.get("HF_TOKEN")
203
  if token is None:
204
  raise ValueError(
205
  "Your machine must be logged in to HF to debug AutoTrain locally. Please "
206
- "set `HF_TOKEN` as environment variable "
207
  "with one of your access token. You can generate a new token in your "
208
  "settings page (https://huggingface.co/settings/tokens)."
209
  )
 
28
  # Add `/login/huggingface`, `/login/callback` and `/logout` routes to enable OAuth in the Gradio app.
29
  # If the app is running in a Space, OAuth is enabled normally. Otherwise, we mock the "real" routes to make the
30
  # user log in with a fake user profile - without any calls to hf.co.
31
+ if os.environ.get("SPACE_ID") is not None:
32
  _add_oauth_routes(app)
33
  else:
34
  _add_mocked_oauth_routes(app)
 
199
 
200
 
201
  def _get_mocked_oauth_info() -> typing.Dict:
202
+ token = os.environ.get("USER_HF_TOKEN")
203
  if token is None:
204
  raise ValueError(
205
  "Your machine must be logged in to HF to debug AutoTrain locally. Please "
206
+ "set `USER_HF_TOKEN` as environment variable "
207
  "with one of your access token. You can generate a new token in your "
208
  "settings page (https://huggingface.co/settings/tokens)."
209
  )