IndicOCR (MLX)

Built with IndicOCR from Bodhan AI / AI4Bharat.

MLX conversion of bodhan-ai/indic-ocr for document parsing on Apple Silicon. A page image becomes reading-ordered Markdown and per-block JSON, with equations in LaTeX and tables in HTML by default.

This repository contains two models:

Stage Directory Model Weights
Layout detection and reading order weights/layout IndicDocLayout: PP-DocLayoutV3 fine-tune, 37 classes, about 33M parameters float32, 133 MB
Block transcription weights/ocr IndicBlockOCR: Qwen3.5-0.8B fine-tune BF16, 1.7 GB, not quantized

Usage

Use an mlx-vlm checkout that includes indic_ocr and pp_doclayout_v3 support. From that checkout:

python -m pip install -e .

Replace page.png with a document image:

from mlx_vlm.models.indic_ocr import IndicOCRParser

with IndicOCRParser.from_pretrained("HashNuke/indic-ocr-mlx") as parser:
    page = parser.parse("page.png")

print(page.markdown)
page.save("page.json")

The pipeline detects and cleans the layout, resolves nested equations, and transcribes eligible blocks using greedy decoding. Skipped regions remain in the JSON with empty text. Closing the parser releases its model references.

page.save writes the image name, dimensions, and block records; Markdown is available separately as page.markdown. Each block has a zero-based order, label, type, pixel-coordinate bbox_xyxy ([x0, y0, x1, y1]), confidence, and text.

Load individual stages

The repository root is a two-stage wrapper, not a standalone OCR model. Download the repository and pass its local stage directories to the loaders:

from pathlib import Path

from huggingface_hub import snapshot_download
from mlx_vlm import load
from mlx_vlm.utils import load_model

root = Path(snapshot_download("HashNuke/indic-ocr-mlx"))
layout = load_model(root / "weights/layout")
layout.eval()
ocr, processor = load(str(root / "weights/ocr"))

Do not pass HashNuke/indic-ocr-mlx/weights/ocr as a repository ID. For stage-specific examples, see the layout README and OCR README.

Languages and validation

Upstream reports printed-text support for English and 22 Indian languages. Handwriting support covers English and 12 Indian languages; it does not cover every printed-text language. See the upstream language coverage for details.

Greedy BF16 OCR matched fresh PyTorch transcriptions on an English title, an equation, and a Telugu line. Complete page parsing was checked on an English paper and annotated Telugu/Hindi gallery panels. A controlled table produced HTML with the expected rows and cell values. These are sample-level checks, not accuracy measurements across all supported languages; the gallery panels retain annotation text and handwriting quality varies.

License

The source weights are distributed under the Indic Open Model License v1.0. This conversion does not change the upstream license.

Downloads last month
40
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for HashNuke/indic-ocr-mlx

Finetuned
(1)
this model