Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

chandra

> 编程语言
Open source

OCR model that handles complex tables, forms, handwriting with full layout.

11.9K stars0 likes0 views
WebsiteGitHub

About

OCR model that handles complex tables, forms, handwriting with full layout.

Datalab

State of the Art models for Document Intelligence


# Chandra OCR 2 Chandra OCR 2 is a state of the art OCR model that converts images and PDFs into structured HTML/Markdown/JSON while preserving layout information. ## Try Chandra on Datalab Our managed platform runs an improved Chandra with higher accuracy than the open weights, zero data retention by default, SOC 2 Type 2, and custom BAAs. If you have high volume workloads, we offer a batch processing service that has processed 200M+ pages per week — we manage the infrastructure so your workloads finish on time. Get started with **$5 in free credits** — [sign up](https://www.datalab.to/?utm_source=gh-chandra) — takes under 30 seconds — or try Chandra in our [public playground](https://www.datalab.to/playground?utm_source=gh-chandra). Commercial self-hosting requires a license — see [Commercial usage](#commercial-usage). For on-prem licensing, [contact us](https://www.datalab.to/contact?utm_source=gh-chandra-onprem). ## News - 3/2026 - Chandra 2 is here with significant improvements to math, tables, layout, and multilingual OCR - 10/2025 - Chandra 1 launched ## Features - Tops external olmocr benchmark and significant improvement in internal multilingual benchmarks - Convert documents to markdown, html, or json with detailed layout information - Support for 90+ languages ([benchmark below](#multilingual-benchmark-table)) - Excellent handwriting support - Reconstructs forms accurately, including checkboxes - Strong performance with tables, math, and complex layouts - Extracts images and diagrams, and adds captions and structured data - Two inference modes: local (HuggingFace) and remote (vLLM server) ## Quickstart The easiest way to start is with the CLI tools: ```shell pip install chandra-ocr # With vLLM (recommended, lightweight install) chandra_vllm chandra input.pdf ./output # With HuggingFace (requires torch) pip install chandra-ocr[hf] chandra input.pdf ./output --method hf # Interactive streamlit app pip install chandra-ocr[app] chandra_app ``` ## Benchmarks Multilingual performance was a focus for us with Chandra 2. There isn't a good public multilingual OCR benchmark, so we made our own. This tests tables, math, ordering, layout, and text accuracy. See full scores [below](#multilingual-benchmark-table). We also have a [full 90-language benchmark](FULL_BENCHMARKS.md). We also benchmarked Chandra 2 with the widely accepted olmocr benchmark: See full scores [below](#benchmark-table). ## Examples | Type | Name | Link | |------|--------------------------|-------------------------------------------------------------------------------------------------------------| | Math | CS229 Textbook | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/math/cs229.png) | | Math | Handwritten Math | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/math/handwritten_math.png) | | Math | Chinese Math | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/math/chinese_math.png) | | Tables | Statistical Distribution | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/tables/complex_tables.png) | | Tables | Financial Table | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/tables/financial_table.png) | | Forms | Registration Form | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/forms/handwritten_form.png) | | Forms | Lease Form | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/forms/lease_filled.png) | | Handwriting | Cursive Writing | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/handwriting/cursive_writing.png) | | Handwriting | Handwritten Notes | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/handwriting/handwritten_notes.png) | | Languages | Arabic | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/languages/arabic.png) | | Languages | Japanese | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/languages/japanese.png) | | Languages | Hindi | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/languages/hindi.png) | | Languages | Russian | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/languages/russian.png) | | Other | Charts | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/other/charts.png) | | Other | Chemistry | [View](https://github.com/datalab-to/chandra/blob/master/assets/examples/other/chemistry.png) | ## Installation ### Package ```bash # Base install (for vLLM backend) pip install chandra-ocr # With HuggingFace backend (includes torch, transformers) pip install chandra-ocr[hf] # With all extras pip install chandra-ocr[all] ``` If you're using the HuggingFace method, we also recommend installing [flash attention](https://github.com/Dao-AILab/flash-attention) for better performance. ### From Source ```bash git clone https://github.com/datalab-to/chandra.git cd chandra uv sync source .venv/bin/activate ``` ## Usage ### CLI Process single files or entire directories: ```bash # Single file, with vllm server (see below for how to launch vllm) chandra input.pdf ./output --method vllm # Process all files in a directory with local model chandra ./documents ./output --method hf ``` **CLI Options:** - `--method [hf|vllm]`: Inference method (default: vllm) - `--page-range TEXT`: Page range for PDFs (e.g., "1-5,7,9-12") - `--max-output-tokens INTEGER`: Max tokens per page - `--max-workers INTEGER`: Parallel workers for vLLM - `--include-images/--no-images`: Extract and save images (default: include) - `--include-headers-footers/--no-headers-footers`: Include page headers/footers (default: exclude) - `--batch-size INTEGER`: Pages per batch (default: 28 for vllm, 1 for hf) **Output Structure:** Each processed file creates a subdirectory with: - `.md` - Markdown output - `.html` - HTML output - `_metadata.json` - Metadata (page info, token count, etc.) - Extracted images are saved directly in the output directory ### Streamlit Web App Launch the interactive demo for single-page processing: ```bash chandra_app ``` ### vLLM Server (Optional) For production deployments or batch processing, use the vLLM server: ```bash chandra_vllm ``` This launches a Docker container with optimized inference settings. Configure via environment variables: - `VLLM_API_BASE`: Server URL (default: `http://localhost:8000/v1`) - `VLLM_MODEL_NAME`: Model name for the server (default: `chandra`) - `VLLM_GPUS`: GPU device IDs (default: `0`) You can also start your own vllm server with the `datalab-to/chandra-ocr-2` model. ### Configuration Settings can be configured via environment variables or a `local.env` file: ```bash # Model settings MODEL_CHECKPOINT=datalab-to/chandra-ocr-2 MAX_OUTPUT_TOKENS=12384 # vLLM settings VLLM_API_BASE=http://localhost:8000/v1 VLLM_MODEL_NAME=chandra VLLM_GPUS=0 ``` # Commercial usage This code is Apache 2.0, and our 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). To remove the OpenRAIL license requirements, or for broader commercial licensing, visit our pricing page [here](https://www.datalab.to/pricing?utm_source=gh-chandra). # Benchmark table | **Model** | ArXiv | Old Scans Math | Tables | Old Scans | Headers and Footers | Multi column | Long tiny text | Base | Overall | Source | |:--------------------------|:--------:|:--------------:|:--------:|:---------:|:-------------------:|:------------:|:--------------:|:--------:|:--------------:|:--------------:| | Datalab API | **90.4** | **90.2** | 90.7 | **54.6** | 91.6 | 83.7 | 92.3 | **99.9** | **86.7 ± 0.8** | Own benchmarks | | Chandra 2 | 86.9 | 89.1 | **92.1** | 51.1 | 91.4 | 82.1 | **93.7** | **99.9** | 85.8 ± 0.8 | Own benchmarks | | dots.ocr 1.5 | 85.9 | 85.5 | 90.7 | 48.2 | 94.0 | **85.3** | 81.6 | 99.7 | 83.9 | dots.ocr repo | | Chandra 1 | 82.2 | 80.3 | 88.0 | 50.4 | 90.8 | 81.2 | 92.3 | **99.9** | 83.1 ± 0.9 | Own benchmarks | | olmOCR 2 | 83.0 | 82.3 | 84.9 | 47.7 | **96.1** | 83.7 | 81.9 | 99.6 | 82.4 | olmocr repo | | dots.ocr | 82.1 | 64.2 | 88.3 | 40.9 | 94.1 | 82.4 | 81.2 | 99.5 | 79.1 ± 1.0 | dots.ocr repo | | olmOCR v0.3.0 | 78.6 | 79.9 | 72.9 | 43.9 | 95.1 | 77.3 | 81.2 | 98.9 | 78.5 ± 1.1 | olmocr repo | | Datalab Marker v1.10.0 | 83.8 | 69.7 | 74.8 | 32.3 | 86.6 | 79.4 | 85.7 | 99.6 | 76.5 ± 1.0 | Own benchmarks | | Deepseek OCR | 75.2 | 72.3 | 79.7 | 33.3 | **96.1** | 66.7 | 80.1 | 99.7 | 75.4 ± 1.0 | Own benchmarks | | Mistral OCR API | 77.2 | 67.5 | 60.6 | 29.3 | 93.6 | 71.3 | 77.1 | 99.4 | 72.0 ± 1.1 | olmocr repo | | GPT-4o (Anchored) | 53.5 | 74.5 | 70.0 | 40.7 | 93.8 | 69.3 | 60.6 | 96.8 | 69.9 ± 1.1 | olmocr repo | | Qwen 3 VL 8B | 70.2 | 75.1 | 45.6 | 37.5 | 89.1 | 62.1 | 43.0 | 94.3 | 64.6 ± 1.1 | Own benchmarks | | Gemini Flash 2 (Anchored) | 54.5 | 56.1 | 72.1 | 34.2 | 64.7 | 61.5 | 71.5 | 95.6 | 63.8 ± 1.2 | olmocr repo | # Multilingual benchmark table 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-table). | Language | Datalab API | Chandra 2 | Chandra 1 | Gemini 2.5 Flash | GPT-5 Mini | |---|:---:|:---:|:---:|:---:|:---:| | ar | 67.6% | 68.4% | 34.0% | 84.4% | 55.6% | | bn | 85.1% | 72.8% | 45.6% | 55.3% | 23.3% | | ca | 88.7% | 85.1% | 84.2% | 88.0% | 78.5% | | cs | 88.2% | 85.3% | 84.7% | 79.1% | 78.8% | | da | 90.1% | 91.1% | 88.4% | 86.0% | 87.7% | | de | 93.8% | 94.8% | 83.0% | 88.3% | 93.8% | | el | 89.9% | 85.6% | 85.5% | 83.5% | 82.4% | | es | 91.8% | 89.3% | 88.7% | 86.8% | 97.1% | | fa | 82.2% | 75.1% | 69.6% | 61.8% | 56.4% | | fi | 85.7% | 83.4% | 78.4% | 86.0% | 84.7% | | fr | 93.3% | 93.7% | 89.6% | 86.1% | 91.1% | | gu | 73.8% | 70

GitHub Issues· 0 open

View all on GitHub

No open issues yet, or sync has not completed.

Highlights

  • •3/2026 - Chandra 2 is here with significant improvements to math, tables, layout, and multilingual OCR
  • •10/2025 - Chandra 1 launched
  • •Tops external olmocr benchmark and significant improvement in internal multilingual benchmarks
  • •Convert documents to markdown, html, or json with detailed layout information
  • •Support for 90+ languages (benchmark below)
  • •Excellent handwriting support
  • •Reconstructs forms accurately, including checkboxes
  • •Strong performance with tables, math, and complex layouts
  • •Extracts images and diagrams, and adds captions and structured data
  • •Two inference modes: local (HuggingFace) and remote (vLLM server)

> Tags

Pythonaiocr

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言