Spaces:
Runtime error
Runtime error
| # Quick Deployment Script for New HF Space | |
| # Run this after creating your new Space on HuggingFace | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| [string]$SpaceURL, | |
| [Parameter(Mandatory=$false)] | |
| [string]$SpaceName = "game-asset-generator-pro-v2" | |
| ) | |
| Write-Host "๐ Deploying to HF Space: $SpaceName" -ForegroundColor Cyan | |
| Write-Host "" | |
| # Check if we're in the right directory | |
| if (-not (Test-Path "app.py")) { | |
| Write-Host "โ Error: app.py not found" -ForegroundColor Red | |
| Write-Host " Run this script from huggingface-space-v2/" -ForegroundColor Yellow | |
| exit 1 | |
| } | |
| # Create temporary deployment directory | |
| $deployDir = "deploy_temp" | |
| Write-Host "๐ Creating deployment directory..." -ForegroundColor Green | |
| New-Item -ItemType Directory -Force -Path $deployDir | Out-Null | |
| # Copy all necessary files | |
| Write-Host "๐ฆ Copying files..." -ForegroundColor Green | |
| $filesToCopy = @( | |
| "app.py", | |
| "requirements.txt", | |
| "Dockerfile", | |
| ".gitignore", | |
| "README.md", | |
| "core", | |
| "generators", | |
| "processors", | |
| "utils", | |
| "scripts" | |
| ) | |
| foreach ($item in $filesToCopy) { | |
| if (Test-Path $item) { | |
| Copy-Item -Recurse -Force $item $deployDir/ | |
| Write-Host " โ Copied: $item" -ForegroundColor Gray | |
| } else { | |
| Write-Host " โ ๏ธ Missing: $item" -ForegroundColor Yellow | |
| } | |
| } | |
| # Create HF Space README header | |
| Write-Host "๐ Creating Space metadata..." -ForegroundColor Green | |
| $readmeHeader = @" | |
| --- | |
| title: 3D Asset Generator Pro V2 | |
| emoji: ๐ฎ | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: gradio | |
| sdk_version: 4.44.0 | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| hardware: l4 | |
| --- | |
| "@ | |
| # Prepend to README | |
| $existingReadme = Get-Content "$deployDir/README.md" -Raw | |
| $newReadme = $readmeHeader + $existingReadme | |
| Set-Content -Path "$deployDir/README.md" -Value $newReadme | |
| Write-Host "" | |
| Write-Host "โจ Deployment package ready in: $deployDir" -ForegroundColor Green | |
| Write-Host "" | |
| Write-Host "Next steps:" -ForegroundColor Cyan | |
| Write-Host "1. Create new Space at: https://huggingface.co/new-space" -ForegroundColor White | |
| Write-Host " - Name: $SpaceName" -ForegroundColor Gray | |
| Write-Host " - SDK: Gradio" -ForegroundColor Gray | |
| Write-Host " - Hardware: L4 GPU" -ForegroundColor Gray | |
| Write-Host "" | |
| Write-Host "2. Clone your Space:" -ForegroundColor White | |
| Write-Host " git clone $SpaceURL" -ForegroundColor Gray | |
| Write-Host "" | |
| Write-Host "3. Copy files:" -ForegroundColor White | |
| Write-Host " Copy-Item -Recurse $deployDir\* YOUR_SPACE_DIR\" -ForegroundColor Gray | |
| Write-Host "" | |
| Write-Host "4. Push to HF:" -ForegroundColor White | |
| Write-Host " cd YOUR_SPACE_DIR" -ForegroundColor Gray | |
| Write-Host " git add ." -ForegroundColor Gray | |
| Write-Host " git commit -m 'Initial deployment - Streamlined architecture'" -ForegroundColor Gray | |
| Write-Host " git push" -ForegroundColor Gray | |
| Write-Host "" | |
| Write-Host "๐ Package Statistics:" -ForegroundColor Cyan | |
| Write-Host " Total files: $(Get-ChildItem -Recurse $deployDir | Measure-Object).Count" -ForegroundColor Gray | |
| Write-Host " Total size: $([math]::Round((Get-ChildItem -Recurse $deployDir | Measure-Object -Property Length -Sum).Sum / 1MB, 2)) MB" -ForegroundColor Gray | |
| Write-Host "" | |
| # Offer to open browser | |
| $openBrowser = Read-Host "Open HuggingFace Spaces in browser? (y/n)" | |
| if ($openBrowser -eq "y") { | |
| Start-Process "https://huggingface.co/new-space" | |
| } | |