Spaces:
Running
Running
| # π ECG-FM Dual Model Deployment to HF Spaces | |
| # PowerShell script to deploy the optimized dual-model ECG-FM API | |
| Write-Host "π DEPLOYING ECG-FM DUAL MODEL API TO HF SPACES" -ForegroundColor Green | |
| Write-Host "=" * 60 -ForegroundColor Green | |
| # Configuration | |
| $SPACE_NAME = "mystic-cbk-ecg-fm-api" | |
| $REPO_URL = "https://huggingface.co/spaces/mystic-cbk/$SPACE_NAME" | |
| $LOCAL_DIR = "." | |
| $BRANCH = "main" | |
| Write-Host "π Deployment Configuration:" -ForegroundColor Yellow | |
| Write-Host " Space Name: $SPACE_NAME" -ForegroundColor White | |
| Write-Host " Repository: $REPO_URL" -ForegroundColor White | |
| Write-Host " Local Directory: $LOCAL_DIR" -ForegroundColor White | |
| Write-Host " Branch: $BRANCH" -ForegroundColor White | |
| Write-Host "" | |
| # Check if git is available | |
| try { | |
| $gitVersion = git --version | |
| Write-Host "β Git available: $gitVersion" -ForegroundColor Green | |
| } catch { | |
| Write-Host "β Git not available. Please install Git first." -ForegroundColor Red | |
| exit 1 | |
| } | |
| # Check if we're in a git repository | |
| if (-not (Test-Path ".git")) { | |
| Write-Host "π Initializing git repository..." -ForegroundColor Yellow | |
| git init | |
| git add . | |
| git commit -m "Initial commit: ECG-FM Dual Model API" | |
| } | |
| # Check current git status | |
| Write-Host "π Current Git Status:" -ForegroundColor Yellow | |
| git status | |
| # Add all changes | |
| Write-Host "π Adding all changes to git..." -ForegroundColor Yellow | |
| git add . | |
| # Commit changes | |
| $commitMessage = "π Deploy ECG-FM Dual Model API v2.0.0 - $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" | |
| Write-Host "πΎ Committing changes: $commitMessage" -ForegroundColor Yellow | |
| git commit -m $commitMessage | |
| # Check if remote exists | |
| $remotes = git remote -v | |
| if ($remotes -match $SPACE_NAME) { | |
| Write-Host "β Remote already exists: $SPACE_NAME" -ForegroundColor Green | |
| } else { | |
| Write-Host "π Adding remote repository..." -ForegroundColor Yellow | |
| git remote add origin $REPO_URL | |
| } | |
| # Push to HF Spaces | |
| Write-Host "π Pushing to Hugging Face Spaces..." -ForegroundColor Green | |
| Write-Host " This will trigger automatic deployment..." -ForegroundColor White | |
| Write-Host "" | |
| try { | |
| git push -u origin $BRANCH --force | |
| Write-Host "β Successfully pushed to HF Spaces!" -ForegroundColor Green | |
| Write-Host "" | |
| Write-Host "π Your API will be available at:" -ForegroundColor Cyan | |
| Write-Host " https://huggingface.co/spaces/mystic-cbk/$SPACE_NAME" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "π Monitor deployment progress at:" -ForegroundColor Cyan | |
| Write-Host " https://huggingface.co/spaces/mystic-cbk/$SPACE_NAME/settings" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "β±οΈ Deployment typically takes 5-10 minutes..." -ForegroundColor Yellow | |
| Write-Host " Models will be downloaded automatically on first startup" -ForegroundColor White | |
| } catch { | |
| Write-Host "β Error pushing to HF Spaces: $_" -ForegroundColor Red | |
| Write-Host "" | |
| Write-Host "π§ Troubleshooting:" -ForegroundColor Yellow | |
| Write-Host " 1. Check your HF token is set: git config --global credential.helper store" -ForegroundColor White | |
| Write-Host " 2. Verify repository permissions" -ForegroundColor White | |
| Write-Host " 3. Check internet connection" -ForegroundColor White | |
| exit 1 | |
| } | |
| Write-Host "" | |
| Write-Host "π DEPLOYMENT INITIATED SUCCESSFULLY!" -ForegroundColor Green | |
| Write-Host "=" * 60 -ForegroundColor Green | |
| Write-Host "" | |
| Write-Host "π Next Steps:" -ForegroundColor Yellow | |
| Write-Host " 1. Monitor deployment at HF Spaces" -ForegroundColor White | |
| Write-Host " 2. Wait for models to download (5-10 minutes)" -ForegroundColor White | |
| Write-Host " 3. Test API endpoints when ready" -ForegroundColor White | |
| Write-Host " 4. Run batch analysis scripts" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "π API Endpoints:" -ForegroundColor Cyan | |
| Write-Host " β’ /health - Health check" -ForegroundColor White | |
| Write-Host " β’ /analyze - Full ECG analysis (both models)" -ForegroundColor White | |
| Write-Host " β’ /extract_features - Feature extraction (pretrained model)" -ForegroundColor White | |
| Write-Host " β’ /assess_quality - Signal quality assessment" -ForegroundColor White | |