gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
34.33k stars 2.61k forks source link

Use the `HF_TOKEN` env variable for `hf_token` of `gr.load` #10074

Open hysts opened 4 days ago

hysts commented 4 days ago

Functions in the huggingface_hub library automatically uses HF_TOKEN for token when token is not specified and the environment variable exists, so I think it would be useful if the hf_token parameter in gr.load behaved in the same way.

abidlabs commented 3 days ago

Yeah we can do that. For security reasons, we wouldn't want to pass it when loading a Space (since a Space in theory can read the incoming headers) but we can do it when loading models.