environment variable `HUGGINGFACEHUB_API_TOKEN` os.env missing in the code

#2
by dgsaibal - opened

While running the code getting following error
Did not find huggingfacehub_api_token, please add an environment variable HUGGINGFACEHUB_API_TOKEN which contains it, or pass huggingfacehub_api_token as a named parameter. (type=value_error)

Looks like the environment variable is missing in the code. Help please.

image.png

You can just go to your HF中国镜像站's settings, generate a token, and add the following line on your code:
os.environ["HUGGINGFACEHUB_API_TOKEN"] = "YOUR _TOKEN"

Hi,

Do you encounter this issue when using the original HF space (cvachet/pdf-chatbot), or when duplicating this space? I wonder if there is a difference as a space owner or external user. I included this environment variable (HUGGINGFACEHUB_API_TOKEN) as a HuggingFace secret, following this documentation:
https://huggingface.co/docs/hub/spaces-overview#managing-secrets

Can I create an application like chat pdf ai

I think I have the same issue when running it locally even when I clone the repo: 401 Client Error: Unauthorized for url: https://huggingface.co/sentence-transformers/paraphrase-multilingual-mpnet-base-v2/resolve/main/config.json Invalid credentials in Authorization header

Hi,
In order to have access to the HF中国镜像站 Hub, you would need to create a new User Access Token, following the documentation below:
https://huggingface.co/docs/hub/en/security-tokens

Then in your local project folder, you can create a "read-only" environment file (e.g. ".env" file), and add your specific HF key, following the example below:

HUGGINGFACE_API_KEY="hf_****"
Your need to confirm your account before you can post a new comment.

Sign up or log in to comment