File size: 1,428 Bytes
12e5518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Deployment Script for Atomic VSA
# Usage: .\deploy.ps1 -RepoId "your-username/atomic-vsa"

param (
    [Parameter(Mandatory = $true)]
    [string]$RepoId = "marshad180/atomic-vsa",
    
    [string]$RepoType = "space", # space, model, or dataset
    [string]$CommitMessage = "Update Atomic VSA deployment"
)

# Determine CLI to use
$cli = "huggingface-cli"
if (Get-Command "hf" -ErrorAction SilentlyContinue) {
    $cli = "hf"
}
elseif (-not (Get-Command "huggingface-cli" -ErrorAction SilentlyContinue)) {
    Write-Host "Error: Neither 'hf' nor 'huggingface-cli' is installed." -ForegroundColor Red
    Write-Host "Please install it using: pip install -U huggingface_hub"
    exit 1
}

# Optional: Enable faster transfer if available
$env:HF_HUB_ENABLE_HF_TRANSFER = 1

# Login check (basic) - just verifying command exists
Write-Host "Deploying to Hugging Face $RepoType : $RepoId using '$cli' ..." -ForegroundColor Cyan

# Upload command
# hf upload <repo_id> <local_path> <path_in_repo> --repo-type <type> --commit-message <msg>
& $cli upload $RepoId . . --repo-type $RepoType --commit-message "$CommitMessage" --exclude ".git/*" "deploy.ps1"

if ($LASTEXITCODE -eq 0) {
    Write-Host "Deployment Successful! 🚀" -ForegroundColor Green
    Write-Host "View your space at: https://huggingface.co/spaces/$RepoId"
}
else {
    Write-Host "Deployment Failed." -ForegroundColor Red
}