File size: 1,659 Bytes
31b6ae7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Simple ECG-FM Deployment to HF Spaces
Write-Host "Deploying ECG-FM Dual Model API to HF Spaces..." -ForegroundColor Green

# Configuration
$SPACE_NAME = "mystic-cbk-ecg-fm-api"
$REPO_URL = "https://huggingface.co/spaces/mystic-cbk/$SPACE_NAME"

Write-Host "Space Name: $SPACE_NAME" -ForegroundColor Yellow
Write-Host "Repository: $REPO_URL" -ForegroundColor Yellow

# Check git
try {
    $gitVersion = git --version
    Write-Host "Git available: $gitVersion" -ForegroundColor Green
} catch {
    Write-Host "Git not available. Please install Git first." -ForegroundColor Red
    exit 1
}

# Initialize git if needed
if (-not (Test-Path ".git")) {
    Write-Host "Initializing git repository..." -ForegroundColor Yellow
    git init
    git add .
    git commit -m "Initial commit: ECG-FM Dual Model API"
}

# Add and commit changes
Write-Host "Adding changes to git..." -ForegroundColor Yellow
git add .
git commit -m "Deploy ECG-FM Dual Model API v2.0.0"

# Add remote if needed
$remotes = git remote -v
if ($remotes -match $SPACE_NAME) {
    Write-Host "Remote already exists" -ForegroundColor Green
} else {
    Write-Host "Adding remote repository..." -ForegroundColor Yellow
    git remote add origin $REPO_URL
}

# Push to HF Spaces
Write-Host "Pushing to Hugging Face Spaces..." -ForegroundColor Green
try {
    git push -u origin main --force
    Write-Host "Successfully pushed to HF Spaces!" -ForegroundColor Green
    Write-Host "Your API will be available at: $REPO_URL" -ForegroundColor Cyan
} catch {
    Write-Host "Error pushing to HF Spaces: $_" -ForegroundColor Red
    exit 1
}

Write-Host "Deployment completed!" -ForegroundColor Green