--- title: Azerbaijani OCR β€” CRNN + CTC emoji: πŸ“œ colorFrom: purple colorTo: indigo sdk: gradio sdk_version: 6.28.0 app_file: app.py short_description: Read Azerbaijani text lines and whole page scans python_version: "3.12" startup_duration_timeout: 1h --- # Azerbaijani OCR β€” CRNN + CTC A Gradio demo for [`LocalDoc/azerbaijani-ocr-crnn`](https://huggingface.co/LocalDoc/azerbaijani-ocr-crnn), an 8.5M-parameter CRNN + CTC recogniser for Azerbaijani print in **Latin and Cyrillic** script (CER 0.0242 / WER 0.0565 on the authors' benchmark). Two modes: - **Line** β€” the recogniser alone on a cropped line of text. This is the model's native input. - **Page** β€” [PP-OCRv5](https://huggingface.co/PaddlePaddle/PP-OCRv5_server_det) detection finds the line boxes, the recogniser reads each crop. Reading order assumes a single column; for two-column pages, read the left half and then the right half using the *Column layout* option. `modeling.py` and the detection / reading-order logic are vendored verbatim or adapted from the model repo (CC-BY-4.0); the weights (`model.pt`) are downloaded from the Hub at startup. ## Limitations From the model card, and worth knowing before you judge an output: - **`a` ↔ `Ι™`.** Training labels came from OCR text layers rather than human transcription, so the model inherited that engine's systematic errors. The most common residual mistake is printing `a` where the page shows `Ι™`. - **Resolution floor.** Source lines run about 20 px high; at that scale the Cyrillic vertical-stroke family (`ΠΈ/Π½/ΠΏ/ΠΌ`) is genuinely ambiguous. - **Greedy CTC decoding** β€” no language model. - The Cyrillic benchmark figure rests on a small number of books and is optimistic. - Very large pages (roughly 30+ detected lines) can exhaust the shared ZeroGPU memory pool while batching. The recogniser halves its batch and retries automatically, so those pages still finish, but a very dense page may take noticeably longer or fail on a busy worker β€” split it if that happens. ## Example assets Line and page examples are real crops from [`LocalDoc/azerbaijani-ocr-benchmark`](https://huggingface.co/datasets/LocalDoc/azerbaijani-ocr-benchmark) (CC-BY-4.0, Β© LocalDoc), the authors' own evaluation set. The page examples stack consecutive benchmark lines into a full-page layout.