Spaces:
Runtime error
Runtime error
Download start.ps1 from Amitkasar/ai-api-testing: direct link, hf CLI and curl.
- Browser
- Download file 2.1 kB
-
https://huggingface.co/spaces/Amitkasar/ai-api-testing/resolve/main/start.ps1
- Command line
-
hf download hf://spaces/Amitkasar/ai-api-testing/start.ps1
-
curl -L -o start.ps1 https://huggingface.co/spaces/Amitkasar/ai-api-testing/resolve/main/start.ps1
2.1 kB
| # ============================================================ | |
| # AI API Testing Tool - Dev Startup Script | |
| # Usage: .\start.ps1 | |
| # ============================================================ | |
| $ErrorActionPreference = "Stop" | |
| Write-Host "" | |
| Write-Host " AI API Testing Tool" -ForegroundColor Cyan | |
| Write-Host " ===================" -ForegroundColor Cyan | |
| Write-Host "" | |
| # --- 1. Kill any stale process on port 8001 --- | |
| # --- 1. Kill any stale process on port 8001 --- | |
| Write-Host "[1/3] Checking for processes on port 8001..." -ForegroundColor Yellow | |
| $stale = netstat -aon | Select-String ":8001 " | Select-String "LISTENING" | |
| if ($stale) { | |
| $pid_ = ($stale -split "\s+")[-1] | |
| Write-Host " Killing stale process (PID $pid_)..." -ForegroundColor DarkYellow | |
| Stop-Process -Id $pid_ -Force -ErrorAction SilentlyContinue | |
| Start-Sleep -Seconds 2 | |
| } else { | |
| Write-Host " Port 8001 is free." -ForegroundColor Green | |
| } | |
| # --- 2. Start FastAPI Backend --- | |
| Write-Host "[2/3] Starting FastAPI backend (port 8001)..." -ForegroundColor Yellow | |
| $backend = Start-Process -FilePath "cmd.exe" ` | |
| -ArgumentList "/k", "title Backend && python -m uvicorn backend.main:app --reload --port 8001 --log-level info" ` | |
| -WorkingDirectory $PSScriptRoot ` | |
| -PassThru | |
| Write-Host " Backend PID: $($backend.Id)" -ForegroundColor Green | |
| Write-Host " Waiting 8s for backend to initialize..." -ForegroundColor DarkGray | |
| Start-Sleep -Seconds 8 | |
| # --- 3. Start React Frontend --- | |
| Write-Host "[3/3] Starting React frontend (Vite dev server)..." -ForegroundColor Yellow | |
| Start-Process -FilePath "cmd.exe" ` | |
| -ArgumentList "/k", "title Frontend && npm run dev" ` | |
| -WorkingDirectory (Join-Path $PSScriptRoot "frontend-react") | |
| Write-Host "" | |
| Write-Host " All services started!" -ForegroundColor Green | |
| Write-Host "" | |
| Write-Host " Backend -> http://localhost:8001" -ForegroundColor Cyan | |
| Write-Host " Frontend -> http://localhost:5173" -ForegroundColor Cyan | |
| Write-Host " API Docs -> http://localhost:8001/docs" -ForegroundColor Cyan | |
| Write-Host "" | |