Add explicit detectors and optional auth

This commit is contained in:
2026-04-11 17:23:25 +02:00
parent 19a5ac16b7
commit 09119e8c0e
7 changed files with 189 additions and 65 deletions

42
docs/README.md Normal file
View File

@@ -0,0 +1,42 @@
# face-lock docs
## Overview
face-lock is a FastAPI service that detects a primary subject, makes a square crop, and returns both a crop and an annotated preview.
## Endpoints
- `GET /health`
- `GET /`
- `POST /api/focus`
- `POST /api/focus/image`
- `GET /docs`
## Detectors
- `face` for human faces
- `animal` for pets / animals, with a contour fallback
- `person` for full-body person detection
- `subject` for general foreground subjects
## Authentication
Set `FACE_LOCK_AUTH_TOKEN` to require a header token.
Supported headers:
- `X-API-Key: <token>`
- `Authorization: Bearer <token>`
Optional override:
- `FACE_LOCK_AUTH_HEADER` changes the expected header name.
## Example
```bash
curl -H 'X-API-Key: your-token' \
-F 'file=@image.jpg' \
-F 'detector=animal' \
http://localhost:8000/api/focus
```