"You must be authenticated to access it" after being granted access and using 'write' token.
I have been granted access ever since the model was released on HF. I have tried using a new token with "write" permission and a fine-grained token. Nothing works. I get the error below--any ideas?
Cannot access gated repo for url https://huggingface.co/api/models/stabilityai/stable-diffusion-3-medium.
Access to model stabilityai/stable-diffusion-3-medium is restricted. You must be authenticated to access it.
A lot of spaces code shows loading a snapshot and assigning the token in the snapshot. So, I made a newbie mistake. If you are loading a gated model you have to login with the token. Something like this:
from huggingface_hub import login
hf_token = os.getenv("HUGGINGFACE_TOKEN")
login(token = hf_token)
where "HUGGINGFACE_TOKEN" is in your secrets section in your Space's settings.