Commit
·
88bff09
1
Parent(s):
61d8ed5
Add GPU status to health check endpoint for monitoring GPU availability
Browse files- api_server.py +11 -1
api_server.py
CHANGED
|
@@ -425,7 +425,17 @@ async def list_result_videos():
|
|
| 425 |
|
| 426 |
@app.get("/api/health")
|
| 427 |
async def api_health():
|
| 428 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 429 |
|
| 430 |
@app.get("/")
|
| 431 |
async def root():
|
|
|
|
| 425 |
|
| 426 |
@app.get("/api/health")
|
| 427 |
async def api_health():
|
| 428 |
+
"""Health check endpoint with GPU status"""
|
| 429 |
+
import onnxruntime
|
| 430 |
+
available_providers = onnxruntime.get_available_providers()
|
| 431 |
+
gpu_available = 'CUDAExecutionProvider' in available_providers
|
| 432 |
+
|
| 433 |
+
return {
|
| 434 |
+
"status": "ok",
|
| 435 |
+
"time": datetime.utcnow().isoformat(),
|
| 436 |
+
"gpu_available": gpu_available,
|
| 437 |
+
"execution_providers": available_providers
|
| 438 |
+
}
|
| 439 |
|
| 440 |
@app.get("/")
|
| 441 |
async def root():
|