SAP Finance Dashboard - Deployment Status & Next Steps
π― Current Status: Ready for Authentication Configuration
Last Commit: dffa786 - Add comprehensive HF authentication setup guide
β What's Working
- UI/Frontend: Fully functional Gradio dashboard on HF Spaces β
- Core Features:
- Dashboard with financial metrics and charts β
- Data Explorer for dataset browsing β
- File Upload for custom datasets β
- OData Connector for SAP integration β
- ML Playground (pending model authentication) β³
- Dependency Resolution: All core packages installed successfully β
- Compatibility Shims: HfFolder import error + JSON schema bug both fixed β
- Docker Build: Single-stage, fast, reliable β
π What Needs: Hugging Face Authentication Token
The SAP-RPT-1-OSS model is a gated model on Hugging Face. The dashboard is ready to use it, but requires authentication.
The Problem
When users try to use model features (Predictions, Playground), they get:
401 Client Error: Unauthorized for url:
https://huggingface.co/SAP/sap-rpt-1-oss/resolve/main/2025-11-04_sap-rpt-one-oss.pt
The Solution
3 Easy Steps (see HF_AUTHENTICATION_SETUP.md for details):
Accept Model Access
- Visit: https://huggingface.co/SAP/sap-rpt-1-oss
- Click "Agree" button
Create HF Access Token
- Go to: https://huggingface.co/settings/tokens
- Create new token with "Read" permission
- Copy the token
Configure in HF Spaces
- Go to: https://huggingface.co/spaces/amitgpt/sap-finance-dashboard-RPT-1-OSS
- Click β Settings β "Repository secrets"
- Add secret:
HF_TOKEN= [your token] - Wait 1-2 minutes for rebuild
After completing these steps, the dashboard will have full access to the SAP-RPT-1-OSS model.
π Code Changes Made
Dockerfile (59 lines)
- Simplified to single-stage build (removed multi-stage complexity)
- Much faster (~2-3 min vs 10+ min for builds)
- Includes torch, transformers, sap-rpt-oss dependencies
- Sets up cache directories for model weights:
/app/hf_cache - New feature: Ready to accept
HF_TOKENenvironment variable
app_gradio.py (1508 lines)
- New Function:
_setup_hf_auth()(lines 78-90)- Automatically logs in to HF using
HF_TOKENenvironment variable - Runs before model initialization
- Graceful fallback if token not provided
- Prints status to logs for debugging
- Automatically logs in to HF using
Location of auth setup:
# Lines 78-90 in app_gradio.py
def _setup_hf_auth():
"""Authenticate with HuggingFace Hub using token from environment."""
try:
from huggingface_hub import login
hf_token = os.getenv("HF_TOKEN") or os.getenv("HUGGINGFACE_TOKEN")
if hf_token:
login(token=hf_token, add_to_git_credential=False)
print("β HuggingFace authentication configured")
else:
print("β HF_TOKEN not found. Gated model access will fail...")
except Exception as e:
print(f"β HuggingFace auth setup failed: {e}")
_setup_hf_auth() # Called at module import time
HF_AUTHENTICATION_SETUP.md (NEW)
- Comprehensive guide for setting up HF authentication
- Step-by-step instructions with screenshots
- Troubleshooting section
- Security best practices
- Local development instructions
π Deployment Architecture
HF Spaces (Host)
βββ Dockerfile (single-stage)
β βββ Python 3.11-slim
β βββ pip install requirements.txt
β βββ pip install Gradio 4.44.1
β βββ pip install PyTorch 2.0.0 + transformers
β βββ pip install sap-rpt-oss
β
βββ app_gradio.py (Entry point)
βββ _ensure_hf_folder_compat() [HfFolder shim]
βββ _patch_gradio_client_schema_bug() [JSON schema fix]
βββ _setup_hf_auth() [NEW: HF token auth]
βββ Launch Gradio app
βββ Load sap-rpt-oss model
π What Happens When You Set HF_TOKEN
At Build Time:
- HF Spaces reads the secret
HF_TOKEN - Container starts with
HUGGINGFACE_TOKENenvironment variable set
- HF Spaces reads the secret
At App Startup (app_gradio.py):
_setup_hf_auth()runs- Logs in to HF Hub with token
- Prints "β HuggingFace authentication configured"
When Model Loads:
- sap-rpt-oss library tries to download model weights
- Request includes HF credentials
- Model download succeeds (200 OK, not 401 Unauthorized)
- Model cached to
/app/hf_cachefor reuse
User Interactions:
- Predictions tab works
- Playground tab works
- Model can train/infer on user data
π Testing Checklist
After setting HF_TOKEN, verify:
- Space rebuild completes (check logs)
- Logs show "β HuggingFace authentication configured"
- No 401 errors in startup logs
- Predictions tab functions
- Can use "Train Model" in Playground
- Model predictions display correctly
π Key URLs
- HF Space: https://huggingface.co/spaces/amitgpt/sap-finance-dashboard-RPT-1-OSS
- Model (Gated): https://huggingface.co/SAP/sap-rpt-1-oss
- HF Token Settings: https://huggingface.co/settings/tokens
- Git Repo (local): c:\Users\amlal\Downloads\VSCode-SAP-AI-Copilot-Projects2025\SAP-RPT-1-OSS-App
π Summary for User
Status: Dashboard is live and fully functional. All features are ready except model-dependent ones (Predictions, Playground), which require 3 simple authentication steps.
Time to Full Functionality: 5-10 minutes
- 2 min: Accept model access + create token
- 5 min: Configure in HF Spaces
- 1-2 min: Space rebuild
Then: All features work, including AI predictions!
Last updated: 2025-01-13 | Commit: dffa786