# chandra | Datalab | Knowledge Base | Instagit

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

GitHub Stars: 6.9k

Repository: https://github.com/datalab-to/chandra

---

## Articles

### [How the paginate_output Option in Chandra Formats Multi-Page Document Outputs](/datalab-to/chandra/chandra-paginate-output-multi-page-formatting)

Learn how Chandra's paginate_output option formats multi-page documents. Insert visual page separators into Markdown and HTML outputs for clearer OCR results.

- Tags: how-to-guide
- Published: 2026-03-27

### [What is MAX_VLLM_RETRIES in Chandra? Understanding vLLM Generation Retry Logic](/datalab-to/chandra/chandra-max-vllm-retries-triggering-conditions)

Discover MAX_VLLM_RETRIES in Chandra. Learn how this setting controls vLLM generation retries for repetitive output or service errors and optimize your LLM performance.

- Tags: internals
- Published: 2026-03-27

### [How the scale_to_fit Function in Chandra Prepares Images for Model Input](/datalab-to/chandra/chandra-scale-to-fit-image-preparation-for-model)

Understand how Chandra's scale_to_fit function prepares images for model input by normalizing size constraints, aligning to a 28x28 grid, and preserving aspect ratios for vision-language models.

- Tags: how-to-guide
- Published: 2026-03-27

### [Understanding the Relationship Between Chandra's BatchInputItem and BatchOutputItem Schemas](/datalab-to/chandra/chandra-batchinputitem-vs-batchoutputitem-schema)

Explore the one-to-one relationship between Chandra's BatchInputItem and BatchOutputItem schemas. Understand how input images transform into detailed model outputs in the inference pipeline.

- Tags: api-reference
- Published: 2026-03-27

### [How to Use the Chandra Streamlit App for Interactive Single-Page Document Processing](/datalab-to/chandra/chandra-streamlit-app-interactive-single-page-processing)

Effortlessly process single-page documents with the Chandra Streamlit app. Run layout-aware OCR locally or remotely, visualizing text, layout, and markdown output instantly.

- Tags: how-to-guide
- Published: 2026-03-27

### [How detect_repeat_token Identifies Generation Failures in Chandra](/datalab-to/chandra/chandra-detect-repeat-token-utility-function)

Learn how Chandra inspects model outputs for repeating token sequences using detect_repeat_token to identify and prevent generation failures.

- Tags: internals
- Published: 2026-03-27

### [Chandra load_file Function: Supported File Formats and Processing Logic](/datalab-to/chandra/chandra-load-file-supported-formats-handling)

Explore Chandra's load_file function. Discover supported formats like PDF and Pillow-readable images, and understand how it converts them to RGB Pillow Image objects.

- Tags: api-reference
- Published: 2026-03-27

### [MAX_OUTPUT_TOKENS in Chandra: Purpose, Default Value, and When to Adjust It](/datalab-to/chandra/chandra-max-output-tokens-setting-adjustment)

Understand MAX_OUTPUT_TOKENS in Chandra. Learn its purpose, default value, and when to adjust this config constant to prevent context window overflows and resource exhaustion.

- Tags: deep-dive
- Published: 2026-03-27

### [How ThreadPoolExecutor in Chandra's vLLM Module Manages Concurrent Page Processing](/datalab-to/chandra/chandra-vllm-threadpoolexecutor-concurrent-page-processing)

Discover how Chandra's vLLM module uses ThreadPoolExecutor to boost concurrent page processing Up to 64 worker threads optimize I/O bound HTTP requests while maintaining batch order

- Tags: internals
- Published: 2026-03-27

### [How Chandra Header and Footer Filtering Works: A Complete Technical Guide](/datalab-to/chandra/chandra-header-footer-filtering-option)

Learn how Chandra's header and footer filtering works. Discover how to omit page headers and footers using the include_headers_footers parameter in this technical guide.

- Tags: deep-dive
- Published: 2026-03-27

### [Supported Prompt Types in Chandra: How PROMPT_MAPPING Configures OCR Modes](/datalab-to/chandra/chandra-supported-prompt-types-prompt-mapping)

Explore supported prompt types in Chandra: ocr_layout and ocr. Learn how PROMPT_MAPPING in prompts.py configures LLM inference for OCR modes.

- Tags: how-to-guide
- Published: 2026-03-27

### [How BBOX_SCALE Controls Layout Detection and Chunk Parsing in Chandra](/datalab-to/chandra/chandra-bbox-scale-layout-detection-chunk-parsing)

Discover how the BBOX_SCALE setting in Chandra controls layout detection and chunk parsing by defining the OCR model's virtual coordinate grid and impacting pixel coordinate conversion.

- Tags: internals
- Published: 2026-03-27

### [Chandra Image Extraction: How to Control Image Inclusion in OCR Output](/datalab-to/chandra/chandra-image-extraction-control)

Learn how Chandra's extract_images function controls image inclusion in OCR output. Use the include_images flag to manage images in HTML and Markdown with this guide.

- Tags: how-to-guide
- Published: 2026-03-27

### [How Chandra Handles vLLM Retries and Repeated Token Detection During Inference](/datalab-to/chandra/chandra-vllm-retry-logic-repeat-token-detection)

Learn how Chandra's vLLM wrapper handles inference retries and detects repeated tokens using a sliding window. It employs increasing temperature and back-off for robust generation.

- Tags: internals
- Published: 2026-03-27

### [Chandra Output Formats and Multi-Page Document Merging Explained](/datalab-to/chandra/chandra-output-formats-and-multi-page-merging)

Explore Chandra output formats like Markdown and HTML. Learn how Chandra merges multi-page documents, concatenates content, and aggregates statistics into a single metadata file.

- Tags: deep-dive
- Published: 2026-03-27

### [How to Process Specific Page Ranges from PDF Documents Using Chandra's CLI](/datalab-to/chandra/chandra-cli-process-pdf-page-ranges)

Easily process specific page ranges from PDFs using Chandra's CLI. Learn how the --page-range flag handles expressions like 1-5,7,9-12 for selective OCR processing.

- Tags: how-to-guide
- Published: 2026-03-27

### [How the InferenceManager Class in Chandra Routes Requests to LLM Backends](/datalab-to/chandra/chandra-inference-manager-backend-routing)

Discover how Chandra's InferenceManager class routes requests to VLLM or Hugging Face LLM backends using its generate method. Learn about conditional branching and backend delegation.

- Tags: internals
- Published: 2026-03-27

### [Chandra OCR --method vllm vs hf: Remote Server vs Local Model Inference](/datalab-to/chandra/chandra-cli-method-vllm-vs-hf-difference)

Understand Chandra's -vllm and -hf methods. Discover remote vLLM inference versus local HuggingFace model execution for your OCR tasks.

- Tags: deep-dive
- Published: 2026-03-27

### [Required Environment Variables for Configuring a Remote vLLM Inference Server in Chandra](/datalab-to/chandra/chandra-configure-remote-vllm-env-vars)

Configure your remote vLLM inference server in Chandra using essential environment variables VLLM_API_BASE VLLM_MODEL_NAME and VLLM_GPUS Learn about optional settings for secure and reliable deployments.

- Tags: how-to-guide
- Published: 2026-03-27

### [How to Choose Between vLLM and HuggingFace Inference Modes in Chandra for Production](/datalab-to/chandra/chandra-production-inference-mode-vllm-vs-hf)

Choose between vLLM and HuggingFace inference in Chandra for production. Use the method parameter to select vLLM for scalable servers or HF for local inference.

- Tags: best-practices
- Published: 2026-03-27

