Use get_token instead of HfFolder.get_token (#10064)

* Use get_token instead of HfFolder.get_token

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Lucain 2024-11-28 16:14:01 +01:00 committed by GitHub
parent b400706fb6
commit c38cf64df6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": minor
---
feat:Use get_token instead of HfFolder.get_token

View File

@ -10,7 +10,7 @@ from dataclasses import dataclass, field
import fastapi
from fastapi.responses import RedirectResponse
from huggingface_hub import HfFolder, whoami
from huggingface_hub import get_token, whoami
from starlette.datastructures import URL
from gradio.utils import get_space
@ -298,7 +298,7 @@ class OAuthToken:
def _get_mocked_oauth_info() -> typing.Dict:
token = HfFolder.get_token()
token = get_token()
if token is None:
raise ValueError(
"Your machine must be logged in to HF to debug a Gradio app locally. Please"