Instructions to use HashNuke/indic-ocr-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use HashNuke/indic-ocr-mlx with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("HashNuke/indic-ocr-mlx") config = load_config("HashNuke/indic-ocr-mlx") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
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
Quantized
Model tree for HashNuke/indic-ocr-mlx
Base model
bodhan-ai/indic-ocr