DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

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

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

Short answer: Run pip install indra-ocr; then run indra-ocr scan.png --format json on one image to see the output shape; read the fields in the output: lines with box and confidence, and blocks with label, bbox, and text. All steps.

  • Research
  • Intermediate
  • 30 minutes
  • From the README
  • Any agent

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

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

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

What you need first

  • Python 3.10 or newer (the README says it is tested on Linux and macOS)
  • pip to install the indra-ocr package
  • An internet connection for the first run, which downloads about 76 MB of models from Hugging Face
  • The PDFs or images to read

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 for your agent

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.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for datalab-to/indra and "Get OCR lines and boxes as JSON for a data pipeline"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer