Spaces:
Sleeping
Sleeping
File size: 2,118 Bytes
5137f76 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# π Quick Deployment Script for Hugging Face Spaces (PowerShell)
Write-Host "π§ Preparing deployment to Hugging Face Spaces..." -ForegroundColor Cyan
# Check if git is initialized
if (-not (Test-Path ".git")) {
Write-Host "β Git repository not initialized. Run: git init" -ForegroundColor Red
exit 1
}
# Check if best.pt exists
if (-not (Test-Path "best.pt")) {
Write-Host "β οΈ Warning: best.pt model file not found!" -ForegroundColor Yellow
Write-Host "Please ensure your YOLO model is present before deployment." -ForegroundColor Yellow
}
# Show current files
Write-Host ""
Write-Host "π Files to be deployed:" -ForegroundColor Green
git ls-files
# Add all files
Write-Host ""
Write-Host "π¦ Staging files..." -ForegroundColor Cyan
git add .
# Commit
Write-Host ""
$commitMsg = Read-Host "Enter commit message (default: 'Optimized for ZeroGPU')"
if ([string]::IsNullOrWhiteSpace($commitMsg)) {
$commitMsg = "Optimized for ZeroGPU"
}
git commit -m "$commitMsg"
# Check remote
$remoteExists = git remote | Select-String "origin"
if (-not $remoteExists) {
Write-Host ""
Write-Host "β οΈ No remote repository configured." -ForegroundColor Yellow
$remoteUrl = Read-Host "Enter Hugging Face Space repository URL"
git remote add origin $remoteUrl
}
# Push
Write-Host ""
Write-Host "π Pushing to Hugging Face Spaces..." -ForegroundColor Cyan
try {
git push -u origin main
} catch {
try {
git push -u origin master
} catch {
Write-Host "β Push failed. Please check your remote configuration." -ForegroundColor Red
exit 1
}
}
Write-Host ""
Write-Host "β
Deployment complete!" -ForegroundColor Green
Write-Host ""
Write-Host "π Next steps:" -ForegroundColor Cyan
Write-Host "1. Go to your Hugging Face Space" -ForegroundColor White
Write-Host "2. Ensure hardware is set to 'ZeroGPU'" -ForegroundColor White
Write-Host "3. Wait for the build to complete (~5 minutes)" -ForegroundColor White
Write-Host "4. Test your application!" -ForegroundColor White
Write-Host ""
Write-Host "π Done!" -ForegroundColor Green
|