monk / HF_AUTH.md
hf-actions
Clean commit: remove virtualenv and large files
ca2863a

A newer version of the Gradio SDK is available: 6.9.0

Upgrade

Hugging Face Space authentication (quick guide)

This repo can be pushed to a Hugging Face Space. Below are minimal steps to authenticate and configure your local folder so git push to the Space works.

  1. Install the CLI (in your venv)
pip install --upgrade huggingface_hub
# optional CLI helper
pip install --upgrade huggingface-hub[cli]
  1. Login interactively (recommended)
huggingface-cli login
# then paste your HF token when prompted
  1. Or set token in .env (non-interactive)

Add one of these lines to your .env (already used by helper scripts):

HF_TOKEN=hf_xxx...
HUGGINGFACEHUB_API_TOKEN=hf_xxx...
  1. Use the helper script to configure git remote (optional)

Run in repo root (will print suggested remote and can add it):

python hf_auth_setup.py

Or manually add remote (replace <token>, <username>, <repo>):

git remote remove origin --no-optional || true
git remote add origin https://<token>@huggingface.co/spaces/<username>/<repo>.git
git push -u origin main

Note: embedding the token in the remote URL is convenient but the token will be visible in your local git config. Use huggingface-cli login or a credential helper for more secure usage.

  1. Space runtime Secrets

In the Hugging Face Space UI set the following Secrets (Settings → Secrets):

  • FB_PAGE_ACCESS_TOKEN
  • FB_PAGE_ID
  • REPLICATE_API_TOKEN
  • OPENAI_API_KEY (if used)
  • RUN_DAILY_REPLICATE (set to true to enable scheduled runs)
  1. Troubleshooting
  • If git push fails with 403, verify the token scope and that the token is valid.
  • You can create a new token at: https://huggingface.co/settings/tokens (grant read and write as needed for repo creation/push).