sci-image / test-hf-space-endpoint.ps1
Gaston895's picture
Add Gradio API ping endpoint
e6453d3
Raw History Blame Contribute Delete
3.17 kB
# Test Hugging Face Space API Endpoints
Write-Host "Testing AEGIS Bio-Digital Lab 10 - Visual System API Endpoints" -ForegroundColor Cyan
Write-Host "=============================================================" -ForegroundColor Cyan
Write-Host ""
$baseUrl = "https://gsstec-sci-image.hf.space"
# Test 1: Ping Endpoint
Write-Host "Test 1: Ping Endpoint" -ForegroundColor Yellow
Write-Host "URL: $baseUrl/api/ping" -ForegroundColor Gray
try {
$response = Invoke-RestMethod -Uri "$baseUrl/api/ping" -Method Get -ErrorAction Stop
Write-Host "✓ SUCCESS" -ForegroundColor Green
Write-Host "Response:" -ForegroundColor Gray
$response | ConvertTo-Json -Depth 3
} catch {
Write-Host "✗ FAILED" -ForegroundColor Red
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
}
Write-Host ""
# Test 2: Health Endpoint
Write-Host "Test 2: Health Endpoint" -ForegroundColor Yellow
Write-Host "URL: $baseUrl/api/health" -ForegroundColor Gray
try {
$response = Invoke-RestMethod -Uri "$baseUrl/api/health" -Method Get -ErrorAction Stop
Write-Host "✓ SUCCESS" -ForegroundColor Green
Write-Host "Response:" -ForegroundColor Gray
$response | ConvertTo-Json -Depth 3
} catch {
Write-Host "✗ FAILED" -ForegroundColor Red
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
}
Write-Host ""
# Test 3: Info Endpoint
Write-Host "Test 3: Info Endpoint" -ForegroundColor Yellow
Write-Host "URL: $baseUrl/api/info" -ForegroundColor Gray
try {
$response = Invoke-RestMethod -Uri "$baseUrl/api/info" -Method Get -ErrorAction Stop
Write-Host "✓ SUCCESS" -ForegroundColor Green
Write-Host "Response:" -ForegroundColor Gray
$response | ConvertTo-Json -Depth 3
} catch {
Write-Host "✗ FAILED" -ForegroundColor Red
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
}
Write-Host ""
# Test 4: Root API Endpoint
Write-Host "Test 4: Root API Endpoint" -ForegroundColor Yellow
Write-Host "URL: $baseUrl/api/" -ForegroundColor Gray
try {
$response = Invoke-RestMethod -Uri "$baseUrl/api/" -Method Get -ErrorAction Stop
Write-Host "✓ SUCCESS" -ForegroundColor Green
Write-Host "Response:" -ForegroundColor Gray
$response | ConvertTo-Json -Depth 3
} catch {
Write-Host "✗ FAILED" -ForegroundColor Red
Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
}
Write-Host ""
# Test 5: API Documentation
Write-Host "Test 5: API Documentation" -ForegroundColor Yellow
Write-Host "URL: $baseUrl/api/docs" -ForegroundColor Gray
Write-Host "Open this URL in your browser to view interactive API documentation" -ForegroundColor Cyan
Write-Host ""
Write-Host "=============================================================" -ForegroundColor Cyan
Write-Host "Testing Complete!" -ForegroundColor Cyan
Write-Host ""
Write-Host "UptimeRobot Configuration:" -ForegroundColor Yellow
Write-Host " Monitor Type: HTTP(s)" -ForegroundColor Gray
Write-Host " URL: $baseUrl/api/ping" -ForegroundColor Gray
Write-Host " Interval: 5 minutes" -ForegroundColor Gray
Write-Host " Expected Response: 200 OK with 'status': 'ok'" -ForegroundColor Gray
# Made with Bob