Environment Setup Guide¶
Setting up HuggingFace Authentication¶
The VideoAnnotator project uses PyAnnote for speaker diarization, which requires a HuggingFace token.
1. Get a HuggingFace Token¶
- Go to HuggingFace Settings
- Create a new token with "Read" permissions
- Signed in as the same account, accept the licence on each model page the viewer lists on the
Speaker turns card (since v1.6.0 just one,
pyannote/speaker-diarization-community-1)
2. Give the token to VideoAnnotator¶
No file to edit and no restart, whichever way you choose. The token stays on the server's machine.
Option A: In the viewer (recommended)¶
On the Pipelines page (or when choosing pipelines for a run), the Speaker turns card shows the three steps above. Paste the token into step 3 and press Save and check: the card names the token's account and shows each licence as accepted or not. You need an admin key (the first key a new install creates is one). To see, change or remove the token later: Settings → API Configuration → Hugging Face token.
Option B: From a terminal¶
uv run videoannotator settings huggingface-token # asks for it, without showing it
uv run videoannotator settings huggingface-token --status # set? which account?
uv run videoannotator settings huggingface-token --remove
With no terminal (a script or an agent), it reads the token from standard input:
printf '%s\n' "$TOKEN" | uv run videoannotator settings huggingface-token.
Options A and B save the token in a file next to the database (huggingface_token, readable only
by you), so in the container it survives being recreated.
Option C: An environment variable¶
A token in the server's environment takes priority over a saved one, and changing it needs a restart. Use this for setups that already manage their environment.
- Copy the example environment file:
cp .env.example .env
- Edit
.envand add your token:# HuggingFace Authentication Token HUGGINGFACE_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Or set it in your shell:
Windows (PowerShell):
$env:HUGGINGFACE_TOKEN="hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Windows (Command Prompt):
set HUGGINGFACE_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Linux/macOS:
export HUGGINGFACE_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3. Test Your Setup¶
Run the diarization test script:
python test_diarization.py
If configured correctly, you should see:
=== Testing PyAnnote Diarization Pipeline ===
1. Checking Prerequisites:
FFmpeg available: True
HuggingFace token: ✓ Found
4. Security Notes¶
- Never commit your
.envfile - it's already in.gitignore - Use the
.env.examplefile as a template for team members - Keep your HuggingFace token secure and don't share it publicly
- Rotate your token periodically for security
5. Troubleshooting¶
"HuggingFace token: ✗ Not found"
- Check that your
.envfile exists in the project root - Verify the token is set as
HUGGINGFACE_TOKEN=your_token_here - Older setups using
HF_AUTH_TOKEN(or Hugging Face's ownHF_TOKEN) still work;HUGGINGFACE_TOKENwins if both are set - Ensure no extra spaces around the equals sign
"Authentication failed"
- Verify your token is valid at HuggingFace Settings
- Make sure you've accepted the terms for pyannote/speaker-diarization-community-1
- Try regenerating your token if it's old
"Model access denied"
- Go to pyannote/speaker-diarization-community-1
- Click "Agree and access repository"
- Wait a few minutes for permissions to propagate