Spaces:
Sleeping
Sleeping
Download run_client.ps1 from Vignesh5656/transformation-api: direct link, hf CLI and curl.
- Browser
- Download file 4.68 kB
-
https://huggingface.co/spaces/Vignesh5656/transformation-api/resolve/main/run_client.ps1
- Command line
-
hf download hf://spaces/Vignesh5656/transformation-api/run_client.ps1
-
curl -L -o run_client.ps1 https://huggingface.co/spaces/Vignesh5656/transformation-api/resolve/main/run_client.ps1
4.68 kB
| # FastAPI Processing Simulator - PowerShell Client Runner | |
| # This script provides easy ways to run the WebSocket client | |
| Write-Host "" | |
| Write-Host "================================================" -ForegroundColor Cyan | |
| Write-Host " FastAPI Processing Simulator - Client Runner" -ForegroundColor Cyan | |
| Write-Host "================================================" -ForegroundColor Cyan | |
| Write-Host "" | |
| # Check if Python is available | |
| try { | |
| $pythonVersion = python --version 2>$null | |
| Write-Host "β Found Python: $pythonVersion" -ForegroundColor Green | |
| } catch { | |
| Write-Host "β Error: Python is not installed or not in PATH" -ForegroundColor Red | |
| Write-Host "Please install Python and try again." | |
| Read-Host "Press Enter to exit" | |
| exit 1 | |
| } | |
| # Check if websockets module is available | |
| try { | |
| python -c "import websockets" 2>$null | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "websockets not found" | |
| } | |
| Write-Host "β WebSockets module is available" -ForegroundColor Green | |
| } catch { | |
| Write-Host "π¦ Installing required websockets module..." -ForegroundColor Yellow | |
| pip install websockets | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Host "β Error: Failed to install websockets module" -ForegroundColor Red | |
| Read-Host "Press Enter to exit" | |
| exit 1 | |
| } | |
| Write-Host "β WebSockets module installed successfully" -ForegroundColor Green | |
| } | |
| function Show-Menu { | |
| Write-Host "" | |
| Write-Host "Select an option:" -ForegroundColor Yellow | |
| Write-Host "1. Interactive mode (default)" -ForegroundColor White | |
| Write-Host "2. Quick test (sample data)" -ForegroundColor White | |
| Write-Host "3. Stress test (5 concurrent requests)" -ForegroundColor White | |
| Write-Host "4. Custom automated test" -ForegroundColor White | |
| Write-Host "5. Show help" -ForegroundColor White | |
| Write-Host "6. Exit" -ForegroundColor White | |
| Write-Host "" | |
| } | |
| function Start-InteractiveMode { | |
| Write-Host "" | |
| Write-Host "π Starting interactive mode..." -ForegroundColor Green | |
| python client.py --interactive | |
| } | |
| function Start-QuickTest { | |
| Write-Host "" | |
| Write-Host "β‘ Running quick test with sample data..." -ForegroundColor Green | |
| python client.py --folder "sample-folder" --env "production" | |
| Read-Host "Press Enter to continue" | |
| } | |
| function Start-StressTest { | |
| Write-Host "" | |
| Write-Host "πͺ Running stress test with 5 concurrent requests..." -ForegroundColor Green | |
| python client.py --stress 5 | |
| Read-Host "Press Enter to continue" | |
| } | |
| function Start-CustomTest { | |
| Write-Host "" | |
| $folder = Read-Host "Enter folder name" | |
| $env = Read-Host "Enter environment" | |
| $url = Read-Host "Enter WebSocket URL (or press Enter for default)" | |
| Write-Host "" | |
| Write-Host "π§ Running custom test..." -ForegroundColor Green | |
| if ([string]::IsNullOrWhiteSpace($url)) { | |
| python client.py --folder $folder --env $env | |
| } else { | |
| python client.py --url $url --folder $folder --env $env | |
| } | |
| Read-Host "Press Enter to continue" | |
| } | |
| function Show-Help { | |
| Write-Host "" | |
| Write-Host "π Help - Available Commands:" -ForegroundColor Cyan | |
| Write-Host "" | |
| Write-Host "Manual Usage:" -ForegroundColor Yellow | |
| Write-Host " python client.py --interactive" -ForegroundColor White | |
| Write-Host " python client.py --folder 'test' --env 'dev'" -ForegroundColor White | |
| Write-Host " python client.py --stress 10" -ForegroundColor White | |
| Write-Host " python client.py --url 'ws://other-server:8000/ws' --folder 'data' --env 'prod'" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "Features:" -ForegroundColor Yellow | |
| Write-Host " β’ Interactive mode with menu-driven interface" -ForegroundColor White | |
| Write-Host " β’ Automated testing with custom parameters" -ForegroundColor White | |
| Write-Host " β’ Stress testing with concurrent requests" -ForegroundColor White | |
| Write-Host " β’ Real-time progress monitoring" -ForegroundColor White | |
| Write-Host " β’ Comprehensive error handling" -ForegroundColor White | |
| Write-Host "" | |
| Read-Host "Press Enter to continue" | |
| } | |
| # Main loop | |
| do { | |
| Show-Menu | |
| $choice = Read-Host "Enter your choice (1-6)" | |
| switch ($choice) { | |
| "1" { Start-InteractiveMode } | |
| "2" { Start-QuickTest } | |
| "3" { Start-StressTest } | |
| "4" { Start-CustomTest } | |
| "5" { Show-Help } | |
| "6" { | |
| Write-Host "" | |
| Write-Host "π Goodbye!" -ForegroundColor Green | |
| exit 0 | |
| } | |
| "" { Start-InteractiveMode } | |
| default { | |
| Write-Host "β Invalid choice. Please try again." -ForegroundColor Red | |
| } | |
| } | |
| } while ($true) |