This is a simple Flask server that wraps EasyOCR to conform to the LiteParse OCR API specification (see ../../OCR_API_SPEC.md).
# install and run (in one command)
uv run server.pyThe service exposes a single endpoint:
POST /ocr- Perform OCR on an uploaded image
file- Image file (multipart/form-data)language- Language code (e.g., 'en', 'fr', 'de')
curl -X POST -F "file=@image.png" -F "language=en" http://localhost:8828/ocr{
"results": [
{
"text": "recognized text",
"bbox": [x1, y1, x2, y2],
"confidence": 0.95
}
]
}This conforms to the LiteParse OCR API specification.
EasyOCR supports 80+ languages. Common language codes:
en- Englishfr- Frenchde- Germanes- Spanishzh- Chineseja- Japaneseko- Koreanar- Arabic
Full list: https://www.jaided.ai/easyocr/
Once the server is running, use it with LiteParse OSS:
# Parse with EasyOCR
lit parse document.pdf --ocr-server-url http://localhost:8828/ocr
# With specific language
lit parse document.pdf --ocr-server-url http://localhost:8828/ocr --ocr-language zhOr in code:
import { LiteParse } from 'liteparse';
const parser = new LiteParse({
ocrServerUrl: 'http://localhost:8828/ocr',
ocrLanguage: 'en',
});
const result = await parser.parse('document.pdf');If you make changes to the server, make sure to adapt and run tests:
uv run pytest test_server.py