Commit History
-
fix(card-ocr): force-reinstall opencv-python-headless after uninstall
paddleocr pulls in opencv-python and opencv-contrib-python alongside the opencv-python-headless we declare in requirements.txt. All three write to the same cv2/ directory with overlapping file lists. Our `pip uninstall -y opencv-python opencv-contrib-python` then deletes files that opencv-python-headless's RECORD also references, leaving cv2 importable but missing constants: AttributeError: module 'cv2' has no attribute 'INTER_LINEAR' (thrown inside paddleocr/tools/infer/predict_rec.py at class body evaluation -- so the failure shows up the first time PaddleOCR is lazy-imported, which is the first /extract call.) Force-reinstall the headless variant after the uninstall to restore every file it owns. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>de8b168 -
fix(card-ocr): bind 0.0.0.0 instead of :: for HF edge proxy
HF Spaces' edge proxy connects to containers over IPv4 only. We were binding uvicorn to '::' (IPv6 wildcard with IPv4-mapped clients implicit on Linux when net.ipv6.bindv6only=0). HF's container runtime evidently does NOT set bindv6only=0, so HF's edge couldn't reach the container at all: - container ran fine internally (uvicorn happy on [::]:7860) - HF showed Space as Running - external curl: TLS succeeds, then HTTP times out at 15s Switching to 0.0.0.0 matches HF's own example Dockerfile in their Docker Spaces docs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>5f100b4 -
fix(card-ocr): add GET / handler for HF Spaces edge healthcheck
HF'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>85aa55f
-
chore: drop Railway mentions from inline comments + docstrings
Pure comment cleanup, no behavior change: - config/urls.py: /ping docstring now credits the host's healthcheck generically (Fly.io's HTTP healthcheck is the dev-tier consumer) - requirements.txt: python-json-logger comment drops the RAILWAY_ENVIRONMENT trigger that was removed from settings.py - services/card_ocr/.dockerignore: replace `railway up` deploy rationale with the actual command (`git subtree push hf main`) - scripts/pg_dump_to_r2.py: module docstring stops describing the script as a Railway-scheduled task and describes its purpose (provider-account loss insurance) generically Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>41d8ccf -
docs(card-ocr): operator runbook for the Hugging Face Space deploy
The Dockerfile + Spaces frontmatter + hf git remote landed in eac3468, but the actual deploy procedure (HF account, repo secret, hf-remote auth, subtree push, smoke tests) was carried in head only. Write it down so it survives. Also retarget the .env.example OCR block at the HF Space URL and bump the example timeout to 30s -- the free CPU tier sleeps after idle and first-call cold-load is 30-60s. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1035f0d -
chore(card-ocr): migrate sidecar deployment from Railway to Hugging Face Space
Sagar Deswal +1: Claude Opus 4.7 (1M context)Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>72de53b
-
feat(card-ocr): PaddleOCR sidecar with Railway-ready config
- Dockerfile: pin python:3.11-slim (paddlepaddle 2.6.2 wheel needs 3.11), drop opencv-python + opencv-contrib-python so headless variant is the only libcv on the path (prevents double-free on first OCR), bake the English model weights into the image so the first request after a deploy isn't a ~10s download. - main.py: emit per-line `blocks` with text + confidence so the Django side can attribute Haiku-extracted fields back to a specific OCR line (per-field confidence aggregation). - railway.json: explicit Dockerfile builder + dual-stack `--host ::` + healthcheck-friendly `--port \${PORT:-8001}` start command so Railway's private network can route to the container. - .dockerignore: belt-and-suspenders so build scratch / test files don't leak into the production image. - docker-compose.yml: card-ocr service block with healthcheck + service_started dep on backend (relaxed from service_healthy so local stub-mode dev doesn't block on the heavy sidecar build). - .env.ex…6f32872
-
chore: consolidate plans, add explicit permissions, and update onboarding flow
Sun7065d8d