| |
| |
|
|
| Write-Host "=========================================" -ForegroundColor Cyan |
| Write-Host "Starting SAM2 Image Auto Segment API" -ForegroundColor Cyan |
| Write-Host "=========================================" -ForegroundColor Cyan |
| Write-Host "" |
|
|
| |
| try { |
| $pythonVersion = python --version 2>&1 |
| Write-Host "Found: $pythonVersion" -ForegroundColor Green |
| } catch { |
| Write-Host "ERROR: Python is not installed or not in PATH!" -ForegroundColor Red |
| Write-Host "Please install Python 3.10 or higher from https://www.python.org/" -ForegroundColor Red |
| exit 1 |
| } |
|
|
| |
| $port = if ($env:PORT) { $env:PORT } else { "8000" } |
|
|
| Write-Host "Using port: $port" -ForegroundColor Yellow |
| Write-Host "" |
| Write-Host "Starting FastAPI server..." -ForegroundColor Cyan |
| Write-Host "API will be available at: http://localhost:$port" -ForegroundColor Green |
| Write-Host "API documentation at: http://localhost:$port/docs" -ForegroundColor Green |
| Write-Host "" |
| Write-Host "Press Ctrl+C to stop the server" -ForegroundColor Yellow |
| Write-Host "" |
|
|
| |
| python -m uvicorn app:app --host 0.0.0.0 --port $port --reload |
|
|
|
|