--- title: BilinguaScript HTR API emoji: ✍️ colorFrom: blue colorTo: green sdk: docker pinned: true app_port: 7860 --- # BilinguaScript Model API FastAPI service that serves fine-tuned TrOCR models for bilingual (EN/FR) handwritten text recognition. ## Endpoints | Method | Path | Description | |--------|------|-------------| | GET | `/health` | Health check | | POST | `/api/v1/transcribe` | Transcribe uploaded image line | ## Environment Variables | Variable | Default | Description | |----------|---------|-------------| | `EN_MODEL_ID` | `unixio/trocr-cameroon-english-lora` | Fine-tuned English model (Cameroonian-adapted, 18.62% CER on held-out Cameroonian writers) | | `FR_MODEL_ID` | `unixio/trocr-rimes-french-lora` | Fine-tuned French model (11.29% CER on RIMES-2011) | | `HF_TOKEN` | — | **Required**: read token for the private model repos (set as a Space secret) | | `NUM_BEAMS` | `4` | Beam search width | | `MAX_LENGTH` | `160` | Max generated tokens per line | ## Request parameters `POST /api/v1/transcribe` (multipart form): | Field | Default | Description | |-------|---------|-------------| | `file` | — | Image (PNG/JPEG) | | `language` | `auto` | `en`/`english`, `fr`/`french`; `auto` falls back to English | | `segment` | `true` | `true`: split a full page into lines first; `false`: treat the upload as one pre-cropped line (what the Django backend sends) |