HuggingFace Authentication Setup for SAP RPT-1-OSS
The SAP Finance Dashboard uses the SAP-RPT-1-OSS model, which is a gated model on Hugging Face. To enable full functionality, you need to:
- Accept access to the gated model
- Create a Hugging Face access token
- Configure the token in HF Spaces
Step 1: Accept Gated Model Access
- Visit: https://huggingface.co/SAP/sap-rpt-1-oss
- Click the "Agree" button to accept access to the gated model
- You may need to be logged in to your Hugging Face account
Step 2: Create a Hugging Face Access Token
- Go to: https://huggingface.co/settings/tokens
- Click "New token"
- Token name:
sap-rpt-oss-access(or any descriptive name) - Type: Select "Read" (this token only needs to download models)
- Click "Create token"
- Copy the token (you won't be able to see it again!)
Step 3: Add Token to HF Spaces
Option A: Via HF Spaces Web UI (Recommended)
- Go to your HF Space: https://huggingface.co/spaces/amitgpt/sap-finance-dashboard-RPT-1-OSS
- Click β Settings (top right)
- Go to "Repository secrets" section
- Click "Add secret"
- Name:
HF_TOKEN - Value: Paste your token from Step 2
- Click "Add secret"
- Wait for the Space to rebuild automatically (~2-5 minutes)
Option B: Via Git (Alternative)
If using git to push directly, you can pass the token at build time:
# In your local repo
git push -u hf main # Push code changes
# Then add via HF Spaces UI as above
Step 4: Verify Setup
- After the Space rebuilds, wait 1-2 minutes
- Refresh the Space URL
- Check the logs (scroll down on the Space page)
- Look for: "β HuggingFace authentication configured"
If you see this message, authentication is working!
Troubleshooting
Error: "401 Client Error: Unauthorized"
- Cause: Token not set or incorrect
- Fix:
- Verify token was accepted in HF Spaces secrets (wait for rebuild)
- Verify you have accepted model access (Step 1)
- Create a new token if needed
Error: "HF_TOKEN not found"
- Cause: Environment variable not set
- Fix: Ensure the secret is named exactly
HF_TOKEN(case-sensitive)
Model still not loading
- Cause: Token may not have correct permissions
- Fix:
- Delete old token
- Create new token with "Read" permission
- Accept model access again
- Update HF Spaces secret
Local Development
If developing locally, set the token in your environment:
# PowerShell
$env:HF_TOKEN = "hf_..."
# Or in .env file
echo "HF_TOKEN=hf_..." >> .env
Then run:
python app_gradio.py
Security Best Practices
- Never commit tokens to git (they're in .gitignore)
- Regenerate tokens if exposed (go to HF settings)
- Use "Read" permission only for model access
- Delete unused tokens from HF settings
What the Dashboard Does With the Token
The token is used only to download the SAP-RPT-1-OSS model weights from Hugging Face Hub. The dashboard:
- Does NOT collect or store your token
- Does NOT upload any data
- Does NOT modify your Hugging Face account
- Only reads the pre-trained model file
Additional Resources
- HF Spaces Documentation: https://huggingface.co/docs/hub/spaces
- HF Tokens Guide: https://huggingface.co/docs/hub/security-tokens
- SAP RPT-1-OSS Model: https://huggingface.co/SAP/sap-rpt-1-oss
After completing these steps, your SAP Finance Dashboard will have full access to the RPT-1-OSS model for predictions and analytics!