SOY NV AI
Fix: Change POST endpoint from /parent-chunk to /process/parent-chunk and improve error handling
9c8de54
| # Hugging Face Spaces μ λ‘λ μ€ν¬λ¦½νΈ | |
| # μ¬μ©λ²: .\upload_to_hf.ps1 -HFSpacePath "C:\path\to\huggingface\space" | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| [string]$HFSpacePath | |
| ) | |
| Write-Host "========================================" -ForegroundColor Cyan | |
| Write-Host "Hugging Face Spaces μ λ‘λ μ€λΉ" -ForegroundColor Cyan | |
| Write-Host "========================================" -ForegroundColor Cyan | |
| # κ²½λ‘ νμΈ | |
| if (-not (Test-Path $HFSpacePath)) { | |
| Write-Host "μ€λ₯: Hugging Face Spaces λλ ν 리λ₯Ό μ°Ύμ μ μμ΅λλ€: $HFSpacePath" -ForegroundColor Red | |
| Write-Host "λ¨Όμ 'git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME' λͺ λ ΉμΌλ‘ ν΄λ‘ νμΈμ." -ForegroundColor Yellow | |
| exit 1 | |
| } | |
| Write-Host "`nλμ λλ ν 리: $HFSpacePath" -ForegroundColor Green | |
| # νμ¬ λλ ν 리 νμΈ | |
| $currentDir = Get-Location | |
| Write-Host "νμ¬ λλ ν 리: $currentDir" -ForegroundColor Green | |
| # νμ νμΌ νμΈ | |
| $requiredFiles = @("app.py", "Dockerfile", "requirements.txt", "README_HF.md") | |
| $missingFiles = @() | |
| foreach ($file in $requiredFiles) { | |
| if (-not (Test-Path $file)) { | |
| $missingFiles += $file | |
| } | |
| } | |
| if ($missingFiles.Count -gt 0) { | |
| Write-Host "`nμ€λ₯: λ€μ νμ νμΌμ΄ μμ΅λλ€:" -ForegroundColor Red | |
| foreach ($file in $missingFiles) { | |
| Write-Host " - $file" -ForegroundColor Red | |
| } | |
| exit 1 | |
| } | |
| # νμ λλ ν 리 νμΈ | |
| $requiredDirs = @("app", "templates", "static") | |
| $missingDirs = @() | |
| foreach ($dir in $requiredDirs) { | |
| if (-not (Test-Path $dir)) { | |
| $missingDirs += $dir | |
| } | |
| } | |
| if ($missingDirs.Count -gt 0) { | |
| Write-Host "`nμ€λ₯: λ€μ νμ λλ ν λ¦¬κ° μμ΅λλ€:" -ForegroundColor Red | |
| foreach ($dir in $missingDirs) { | |
| Write-Host " - $dir" -ForegroundColor Red | |
| } | |
| exit 1 | |
| } | |
| Write-Host "`nνμ νμΌ λ° λλ ν 리 νμΈ μλ£!" -ForegroundColor Green | |
| # νμΌ λ³΅μ¬ μμ | |
| Write-Host "`nνμΌ λ³΅μ¬ μμ..." -ForegroundColor Yellow | |
| try { | |
| # νμ νμΌ λ³΅μ¬ | |
| Write-Host "`n[1/4] νμ νμΌ λ³΅μ¬ μ€..." -ForegroundColor Cyan | |
| Copy-Item "app.py" "$HFSpacePath\" -Force | |
| Copy-Item "Dockerfile" "$HFSpacePath\" -Force | |
| Copy-Item "requirements.txt" "$HFSpacePath\" -Force | |
| Copy-Item "README_HF.md" "$HFSpacePath\README.md" -Force | |
| Write-Host " β νμ νμΌ λ³΅μ¬ μλ£" -ForegroundColor Green | |
| # app λλ ν 리 λ³΅μ¬ | |
| Write-Host "`n[2/4] app λλ ν 리 λ³΅μ¬ μ€..." -ForegroundColor Cyan | |
| if (Test-Path "$HFSpacePath\app") { | |
| Remove-Item "$HFSpacePath\app" -Recurse -Force | |
| } | |
| Copy-Item -Recurse "app" "$HFSpacePath\app" -Force | |
| Write-Host " β app λλ ν 리 λ³΅μ¬ μλ£" -ForegroundColor Green | |
| # templates λλ ν 리 λ³΅μ¬ | |
| Write-Host "`n[3/4] templates λλ ν 리 λ³΅μ¬ μ€..." -ForegroundColor Cyan | |
| if (Test-Path "$HFSpacePath\templates") { | |
| Remove-Item "$HFSpacePath\templates" -Recurse -Force | |
| } | |
| Copy-Item -Recurse "templates" "$HFSpacePath\templates" -Force | |
| Write-Host " β templates λλ ν 리 λ³΅μ¬ μλ£" -ForegroundColor Green | |
| # static λλ ν 리 λ³΅μ¬ | |
| Write-Host "`n[4/4] static λλ ν 리 λ³΅μ¬ μ€..." -ForegroundColor Cyan | |
| if (Test-Path "$HFSpacePath\static") { | |
| Remove-Item "$HFSpacePath\static" -Recurse -Force | |
| } | |
| Copy-Item -Recurse "static" "$HFSpacePath\static" -Force | |
| Write-Host " β static λλ ν 리 λ³΅μ¬ μλ£" -ForegroundColor Green | |
| Write-Host "`n========================================" -ForegroundColor Cyan | |
| Write-Host "νμΌ λ³΅μ¬ μλ£!" -ForegroundColor Green | |
| Write-Host "========================================" -ForegroundColor Cyan | |
| Write-Host "`nλ€μ λ¨κ³:" -ForegroundColor Yellow | |
| Write-Host "1. Hugging Face Spaces λλ ν λ¦¬λ‘ μ΄λ: cd $HFSpacePath" -ForegroundColor White | |
| Write-Host "2. Git 컀λ°: git add ." -ForegroundColor White | |
| Write-Host "3. Git 컀λ°: git commit -m 'Initial deployment'" -ForegroundColor White | |
| Write-Host "4. Git νΈμ: git push" -ForegroundColor White | |
| Write-Host "`nλλ Hugging Face μΉ μΈν°νμ΄μ€μμ νμΌμ νμΈνκ³ μ»€λ°νμΈμ." -ForegroundColor White | |
| } catch { | |
| Write-Host "`nμ€λ₯ λ°μ: $_" -ForegroundColor Red | |
| exit 1 | |
| } | |