# deploy_hf.ps1 - Automated Deployment Helper for Hugging Face Spaces Write-Host "==========================================================" -ForegroundColor Cyan Write-Host " SECUREATTEND AI FACIAL ATTENDANCE HF DEPLOYER " -ForegroundColor Cyan Write-Host "==========================================================" -ForegroundColor Cyan # 1. Check for Git repository initialization if (-not (Test-Path ".git")) { Write-Host "[*] Initializing local Git repository..." -ForegroundColor Yellow git init git checkout -b main } # 2. Collect Hugging Face Credentials $Username = Read-Host "Enter your Hugging Face Username" $SpaceName = Read-Host "Enter your desired Space Name (e.g., face-attendance)" $Token = Read-Host "Enter your Hugging Face Access Token (requires WRITE permissions)" if (-not $Username -or -not $SpaceName -or -not $Token) { Write-Host "[-] Error: Username, Space Name, and Token are required to deploy!" -ForegroundColor Red Exit } # 3. Create commit Write-Host "[*] Staging files for Git..." -ForegroundColor Yellow git add . git commit -m "Deploy biometric node to HF Spaces" # 4. Set authenticated remote $RemoteName = "huggingface" $RemoteUrl = "https://checkout:$($Token)@huggingface.co/spaces/$($Username)/$($SpaceName)" # Check if remote already exists, remove it if so $ExistingRemotes = git remote if ($ExistingRemotes -contains $RemoteName) { git remote remove $RemoteName } git remote add $RemoteName $RemoteUrl # 5. Push to Hugging Face Write-Host "[*] Pushing to Hugging Face Spaces (this will upload code & ONNX models)..." -ForegroundColor Yellow git push $RemoteName main --force Write-Host "`n[+] Push complete!" -ForegroundColor Green Write-Host "[+] Your space will now build and be available shortly at:" -ForegroundColor Green Write-Host " https://huggingface.co/spaces/$($Username)/$($SpaceName)" -ForegroundColor Cyan Write-Host "==========================================================" -ForegroundColor Cyan