3cf4a9a40a
python / test (push) Failing after 8s
- Updated README.md to reflect new features and API changes. - Introduced versioning in app initialization. - Enhanced configuration management in app/config.py with new validation functions. - Refactored main.py to improve request handling and response generation. - Added new models in app/models.py for structured API responses. - Implemented a dedicated UI rendering function in app/ui.py. - Improved Docker configuration for better security and health checks. - Updated tests to cover new validation rules and response formats. - Added CLAUDE.md for project guidelines and working rules.
1.6 KiB
1.6 KiB
face-lock docs
Overview
face-lock is a FastAPI service for square subject crops. It uses OpenCV-based
detectors, returns stable JSON metadata for preview workflows, and can also
stream the cropped JPEG directly for simple image pipelines.
Endpoints
GET /healthGET /POST /api/focusPOST /api/focus/imageGET /docsGET /openapi.json
Detector modes
facefor frontal human facesanimalfor pets and animals, with contour fallbackpersonfor full-body people detectionsubjectfor generic foreground contour detection
Request validation
- Uploads must be non-empty.
- Uploads must stay below
FACE_LOCK_MAX_UPLOAD_BYTES. - Content types must match
FACE_LOCK_ALLOWED_MIME_TYPES. buffer_ratiois clamped at the API layer to the0.0to0.6range.
Authentication
Set FACE_LOCK_AUTH_TOKEN to require a shared secret.
Supported forms:
X-API-Key: <token>Authorization: Bearer <token>
Optional override:
FACE_LOCK_AUTH_HEADER
Example
curl \
-H 'X-API-Key: your-token' \
-F 'file=@image.jpg' \
-F 'detector=animal' \
-F 'buffer_ratio=0.2' \
http://localhost:8000/api/focus
Binary crop response:
curl \
-H 'X-API-Key: your-token' \
-F 'file=@image.jpg' \
http://localhost:8000/api/focus/image \
--output crop.jpg
Container notes
- The production image runs as a non-root user.
- The container includes a
/healthhealthcheck. - Compose runs the root filesystem read-only and mounts
/tmpas tmpfs.
If you change .env, recreate the container:
docker compose up -d --force-recreate