tetrak_ocr.backends.marker

OCR a single image or PDF file using Marker (marker-pdf).

Marker is a document-to-Markdown converter built on Surya layout and text recognition models. It produces clean, structured Markdown from PDFs and common image formats, preserving headings, tables, and column order better than traditional OCR pipelines.

Model weights (~500 MB–1 GB total) are downloaded on first use and cached at ~/.cache/marker/ (or the platform default for HuggingFace Hub). Each subsequent call reuses the in-memory singleton, so only the first call in a process is slow.

Requires:

pip install marker-pdf

Usage (standalone):

tetrak-ocr ocr workspace/scans/my-document.pdf –backend marker tetrak-ocr ocr workspace/scans/my-postcard.jpg –backend marker

Functions

ocr_image(path)

Extract text from an image or PDF using Marker.