digifreely commited on
Commit
861acb3
Β·
verified Β·
1 Parent(s): 21afc7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -461,6 +461,12 @@ class DatasetRequest(BaseModel):
461
  async def health():
462
  return {"status": "ok", "model": LLM_MODEL_ID, "zerogpu": _ZEROGPU}
463
 
 
 
 
 
 
 
464
 
465
  # ─────────────────────────────────────────────────────────────────────────────
466
  # Change 3: /dataset endpoint
 
461
  async def health():
462
  return {"status": "ok", "model": LLM_MODEL_ID, "zerogpu": _ZEROGPU}
463
 
464
+ @_fastapi.get("/ping", tags=["Utility"])
465
+ async def ping(request: Request):
466
+ """Health-check endpoint – wakes the Space if sleeping."""
467
+ if not await _authenticate(request):
468
+ raise HTTPException(status_code=403, detail="Forbidden")
469
+ return JSONResponse(content={"status": "alive"})
470
 
471
  # ─────────────────────────────────────────────────────────────────────────────
472
  # Change 3: /dataset endpoint