File size: 2,116 Bytes
6a0d82c
 
 
 
 
 
 
3ca5518
 
 
 
6a0d82c
 
3ca5518
6a0d82c
3ca5518
6a0d82c
3ca5518
 
 
 
 
 
6a0d82c
 
 
 
3ca5518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a0d82c
 
3ca5518
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
tags:
- mlx
- ocr
- indic
library_name: mlx-vlm
pipeline_tag: image-text-to-text
license: other
license_name: indic-open-model-license-1.0
license_link: https://huggingface.co/HashNuke/indic-ocr-mlx/blob/main/LICENSE.md
base_model: bodhan-ai/indic-ocr
---

# IndicBlockOCR (MLX)

Built with IndicBlockOCR from Bodhan AI / AI4Bharat.

The recognition stage of [IndicOCR (MLX)](https://huggingface.co/HashNuke/indic-ocr-mlx):
a Qwen3.5-0.8B fine-tune for transcribing text, equations, and tables from
cropped document regions. The weights are BF16 (1.7 GB), not quantized.

Use an mlx-vlm checkout with `indic_ocr` support. Replace `crop.png` with an
image of a text region, not a complete multi-region page:

```python
from pathlib import Path

from huggingface_hub import snapshot_download
from PIL import Image
from mlx_vlm import generate, load
from mlx_vlm.models.indic_ocr.processing_indic_ocr import area_clamp, prompt_for
from mlx_vlm.prompt_utils import apply_chat_template

root = Path(snapshot_download(
    "HashNuke/indic-ocr-mlx", allow_patterns=["weights/ocr/*"]
))
model, processor = load(str(root / "weights/ocr"))
with Image.open("crop.png") as image:
    crop = area_clamp(image.convert("RGB"))
prompt = apply_chat_template(
    processor, model.config, prompt_for("Text"), num_images=1
)
result = generate(
    model, processor, prompt, [crop],
    max_tokens=2048, temperature=0.0, verbose=False,
)
print(result.text)
```

Use `prompt_for("Equation")` for LaTeX or `prompt_for("Table")` for HTML
tables. Greedy decoding (`temperature=0.0`) matches the default page pipeline.

The repository root is a two-stage wrapper: `load("HashNuke/indic-ocr-mlx")`
does not load this OCR stage. Use the local `weights/ocr` path above, or
`IndicOCRParser.from_pretrained("HashNuke/indic-ocr-mlx")` for complete pages,
as shown in the [main model card](https://huggingface.co/HashNuke/indic-ocr-mlx).

The source weights are from [bodhan-ai/indic-ocr](https://huggingface.co/bodhan-ai/indic-ocr)
under the [Indic Open Model License v1.0](https://huggingface.co/HashNuke/indic-ocr-mlx/blob/main/LICENSE.md).