AIniverse Get the App

chandra-ocr-2

Chandra 2 is a state of the art OCR model from [Datalab](https://www.datalab.to) that outputs markdown, HTML, and JSON. It is highly accurate at extracting text from images and PDFs, while preserving layout information. Try Chandra in the [free playground](https://www.datalab.to/playground), or use the [hosted API](https://www.datalab.to/) for higher accuracy and speed. - 85.8% olmocr bench score (sota), 77.8% multilingual bench score (12% improvement over Chandra 1) - Significant improvements to math, tables, complex layouts - Improved layout, especially on wider documents - Significantly better image captioning - 90+ language support with major accuracy gains - Convert documents to markdown, HTML, or JSON with detailed layout information - Excellent handwriting support - Reconstructs forms accurately, including checkboxes - Strong performance with tables, math, and complex layouts - Extracts images and diagrams, with captions and structured data - Support for 90+ languages pip install chandra-ocr chandra_vllm chandra input.pdf ./output pip install chandra-ocr[hf] chandra input.pdf ./output --method hf from chandra.model import InferenceManager from chandra.model.schema import BatchInputItem from PIL import Image manager = InferenceManager(method="vllm") batch = [ BatchInputItem( image=Image.open("document.png"), prompt_type="ocr_layout" ) ] result = manager.generate(batch)[0] print(result.markdown) from transformers import AutoModelForImageTextToText, AutoProcessor from chandra.model.hf import generate_hf from chandra.model.schema import BatchInputItem from chandra.output import parse_markdown from PIL import Image import torch model = AutoModelForImageTextToText.from_pretrained( "datalab-to/chandra-ocr-2", dtype=torch.bfloat16, device_map="auto", ) model.eval() model.processor = AutoProcessor.from_pretrained("datalab-to/chandra-ocr-2") model.processor.tokenizer.padding_side = "left" batch = [ BatchInputItem( image=Image.open("document.png"), prompt_type="ocr_layout" ) ] result = generate_hf(batch, model)[0] markdown = parse_markdown(result.raw) print(markdown) The table below covers the 43 most common languages, benchmarked across multiple models. For a comprehensive evaluation across 90 languages (Chandra 2 vs Gemini 2.5 Flash only), see the [full 90-language benchmark](#full-90-language-benchmark). We also have a more comprehensive evaluation covering 90 languages, comparing Chandra 2 against Gemini 2.5 Flash. The average scores are lower than the 43-language table above because this includes many lower-resource languages. Chandra 2 averages **72.7%** vs Gemini 2.5 Flash at **60.8%**. See the [full 90-language results](https://github.com/datalab-to/chandra/blob/master/FULL_BENCHMARKS.md). Benchmarked with vLLM on a single NVIDIA H100 80GB GPU using a diverse mix of documents (math, tables, scans, multi-column layouts) from the olmOCR benchmark set. This set is significantly slower than real-world usage - we estimate 2 pages/s in real-world usage. Code is Apache 2.0. Model weights use a modified OpenRAIL-M license: free for research, personal use, and startups under $2M funding/revenue. Cannot be used competitively with our API. For broader commercial licensing, see [pricing](https://www.datalab.to/pricing?utm_source=gh-chandra). - [Huggingface Transformers](https://github.com/huggingface/transformers) - [vLLM](https://github.com/vllm-project/vllm) - [olmocr](https://github.com/allenai/olmocr) - [Qwen 3.5](https://github.com/QwenLM/Qwen3)

Parameters
5.3B
Modality
text+image->text
License
openrail
Open source
Yes

Open chandra-ocr-2 in AIniverse

Compare versions, read real ratings, save to your stack.

Open in App