Skip to content

Commit c38cf64

Browse files
Wauplingradio-pr-bot
andauthoredNov 28, 2024
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>
1 parent b400706 commit c38cf64

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
 

‎.changeset/itchy-facts-retire.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gradio": minor
3+
---
4+
5+
feat:Use get_token instead of HfFolder.get_token

‎gradio/oauth.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import fastapi
1212
from fastapi.responses import RedirectResponse
13-
from huggingface_hub import HfFolder, whoami
13+
from huggingface_hub import get_token, whoami
1414
from starlette.datastructures import URL
1515

1616
from gradio.utils import get_space
@@ -298,7 +298,7 @@ def list_organizations(oauth_token: Optional[gr.OAuthToken]) -> str:
298298

299299

300300
def _get_mocked_oauth_info() -> typing.Dict:
301-
token = HfFolder.get_token()
301+
token = get_token()
302302
if token is None:
303303
raise ValueError(
304304
"Your machine must be logged in to HF to debug a Gradio app locally. Please"

0 commit comments

Comments
 (0)