# AI use cases for Indra (datalab-to/indra)

Repo: [datalab-to/indra](https://github.com/datalab-to/indra) | Use cases: 4 | Page: https://dedupedai.com/use-cases/datalab-to-indra/

Indra OCR is a CPU-based OCR tool that turns PDFs and images into markdown, text, or JSON with boxes, layout blocks, and reading order.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Turn a folder of scanned PDFs into markdown files: https://dedupedai.com/use-cases/datalab-to-indra/scanned-pdfs-to-searchable-markdown/
- Get OCR lines and boxes as JSON for a data pipeline: https://dedupedai.com/use-cases/datalab-to-indra/ocr-to-json-with-boxes-for-a-pipeline/
- Check OCR results on each page in a local viewer: https://dedupedai.com/use-cases/datalab-to-indra/review-ocr-output-in-local-viewer/
- Read mixed-language and handwritten scans in one run: https://dedupedai.com/use-cases/datalab-to-indra/ocr-multilingual-and-handwritten-scans/

## How to turn a folder of scanned PDFs into markdown files with Indra

Repo: [datalab-to/indra](https://github.com/datalab-to/indra) | Difficulty: Intermediate | Time: 15 minutes | Basis: From the README

Batch-convert scanned PDFs to one markdown file each, using all CPU cores.

**Who it is for:** A researcher, paralegal, or office worker with a folder of scanned PDFs who needs editable text without a GPU or a cloud upload.

**The problem:** Scanned PDFs cannot be searched, quoted, or edited, and manual retyping is slow.

**The outcome:** One .md file per input PDF in a results folder, with headings, paragraphs, lists, and tables kept where the layout allows.

### Steps

1. Run `pip install indra-ocr`.
2. Move the scanned PDFs into one folder and open a terminal in that folder.
3. Run `indra-ocr *.pdf --out results/` to write one .md file per input.
4. Open a few files in results/ and compare them with the original pages.
5. If a run hits an unreadable file, note its name; the CLI continues past it and exits with 1 if any failed.

### Prompt to paste into your agent

```text
In the repo datalab-to/indra, install indra-ocr with pip and run `indra-ocr <folder>/*.pdf --out results/`. Expected output: one .md file per input PDF in results/. Verify that each .md file is non-empty and that the CLI exit code is 0, or list the files that failed.
```

### Caveat

The code is Apache 2.0, but the model weights use a modified OpenRAIL-M license that limits some commercial and competitive uses, so check the license before using it in a product.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/datalab-to-indra/scanned-pdfs-to-searchable-markdown/

## How to get OCR lines and boxes as JSON for a data pipeline with Indra

Repo: [datalab-to/indra](https://github.com/datalab-to/indra) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Extract each line with its box, confidence, and layout label as JSON.

**Who it is for:** A developer or analyst building a document workflow that needs to know where each piece of text sits on the page.

**The problem:** Plain text loses the position and type of each line, so downstream code cannot find tables, headers, or form fields.

**The outcome:** A JSON file per input with lines, boxes, layout blocks, confidences, and timings that a script can parse.

### Steps

1. Run `pip install indra-ocr`.
2. Run `indra-ocr scan.png --format json` on one image to see the output shape.
3. Read the fields in the output: lines with box and confidence, and blocks with label, bbox, and text.
4. Write a short script that loads the JSON and filters blocks by label such as Table, Form, or Section-Header.
5. Run the same command on a PDF with `indra-ocr paper.pdf --format json` once the shape is clear. (inferred, check the README)

### Prompt to paste into your agent

```text
Using the repo datalab-to/indra, install indra-ocr and run `indra-ocr <input-file> --format json` on <input-file>. Expected output: JSON with lines (box, text, confidence) and blocks (label, bbox, text) per page. Verify that the block labels in the output match the labels listed in the README, such as Text, Table, and Form.
```

### Caveat

The README gives the field names, but the exact JSON structure should be confirmed on your own file before a script depends on it.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/datalab-to-indra/ocr-to-json-with-boxes-for-a-pipeline/

## How to check OCR results on each page in a local viewer with Indra

Repo: [datalab-to/indra](https://github.com/datalab-to/indra) | Difficulty: Beginner | Time: 15 minutes | Basis: From the README

Drop in a scan and see lines, blocks, and reading order drawn over the page.

**Who it is for:** A reviewer who must verify OCR accuracy on a few important pages before relying on the text, and who should not upload them to a web service.

**The problem:** Text output alone hides which lines were misread or placed in the wrong reading order.

**The outcome:** A browser view at localhost showing each page with its lines, layout blocks, confidences, and the markdown source.

### Steps

1. Run `pip install indra-ocr`.
2. Run `indra-ocr-viewer` and open http://localhost:8765 in a browser.
3. Drop in a PDF or an image; each page shows its lines and layout blocks over the page.
4. Toggle lines, blocks, and reading order to find misread text or wrong order.
5. Over SSH, forward the port with `ssh -N -L 8765:localhost:8765 host` as the README describes.

### Prompt to paste into your agent

```text
In the repo datalab-to/indra, install indra-ocr and start `indra-ocr-viewer --port 8765`. Expected output: a local web page at http://localhost:8765 that shows OCR lines and layout blocks for a dropped file. Verify that the page loads and that line confidences are visible.
```

### Caveat

The viewer's files stay on your machine according to the README, but the first run still downloads the models from Hugging Face.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/datalab-to-indra/review-ocr-output-in-local-viewer/

## How to read mixed-language and handwritten scans in one run with Indra

Repo: [datalab-to/indra](https://github.com/datalab-to/indra) | Difficulty: Advanced | Time: 45 minutes | Basis: From the README

OCR scans in many scripts and handwriting, with a CJK-only or RTL-only fallback when needed.

**Who it is for:** A team processing archival or community documents in Chinese, Arabic, Hindi, or handwritten Latin text who needs one tool for all of them.

**The problem:** Most OCR tools need a separate setup per script, and handwriting is often skipped entirely.

**The outcome:** Markdown or text output for pages in many scripts, with handwriting read where it appears in Latin script.

### Steps

1. Run `pip install indra-ocr`.
2. Run `indra-ocr <file>.pdf --mode ocr --timings` to OCR every page and see the time per page on stderr. (inferred, check the README)
3. Check the output for the scripts you care about, such as Chinese, Arabic, or Devanagari.
4. Confirm the handwriting pages read as expected, keeping in mind the README gives a 25.2% handwriting score on its tests.
5. Use `indra-ocr <file>.pdf --format text` if you only need plain lines. (inferred, check the README)

### Prompt to paste into your agent

```text
Using the repo datalab-to/indra, install indra-ocr and run `indra-ocr <file>.pdf --mode ocr --timings` on <file>.pdf. Expected output: markdown with the text in each script and per-page timings on stderr. Verify the text for each script against the source page, since handwriting accuracy is limited.
```

### Caveat

The README reports low handwriting accuracy on its own tests, so results on handwritten pages need a human check before use.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/datalab-to-indra/ocr-multilingual-and-handwritten-scans/
