Commit ·
85aa55f
1
Parent(s): 41d8ccf
fix(card-ocr): add GET / handler for HF Spaces edge healthcheck
Browse filesHF's edge probes GET / on every Space to decide whether it's
'running'. Our FastAPI app exposed /health and /extract but no root
route, so the probe got 404, HF marked the Space unhealthy, and
killed the container after the 30-min grace window:
Launch timed out, workload was not healthy after 30 min
INFO: Started server process [1]
INFO: Uvicorn running on http://[::]:7860
INFO: Shutting down
Add a GET / handler returning the same {ok: true} shape so the
probe passes and the Space stays up.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
102 unmodified lines103104105106107108102 unmodified linesreturn joined, round(mean_conf, 4), blocks@app.get("/health")def health() -> JSONResponse:"""Liveness probe. Returns 200 once the process is up; the OCR102 unmodified lines103104105106107108109110111112113114115116117102 unmodified linesreturn joined, round(mean_conf, 4), blocks@app.get("/")def root() -> JSONResponse:"""HF Spaces' edge healthcheck pings GET / to decide if the Spaceis 'running'. Without a handler here the Space gets a 404 and HFmarks it unhealthy, then kills the container after 30 min. Returnthe same shape as /health so anything probing either gets a 200."""return JSONResponse({"ok": True, "service": "card-ocr"})@app.get("/health")def health() -> JSONResponse:"""Liveness probe. Returns 200 once the process is up; the OCR
main.py+9