Skip to main content

A document layout pipeline for detecting tables, images, and structured extraction.

Project description

readgrid

readgrid is a Python package for document layout analysis and content extraction.
It lets you upload scanned documents, automatically detect tables and images, manually adjust bounding boxes, and extract clean structured output using LLMs.


✨ Features

  • Stage 1 – Upload & Detect

    • Upload document images.
    • Automatically detect tables (red boxes) and images (green boxes).
    • Manually edit bounding boxes with an interactive editor.
  • Stage 2 – Coordinate Testing

    • Verify detected regions with side-by-side previews.
    • Test either existing detections or custom coordinates.
  • Stage 3 – Content Extraction

    • Extract structured JSON output (header, text, footer).
    • Replace detected tables with clean HTML <table> tags.
    • Insert [image] placeholders with captions in reading order.
    • Supports LaTeX formatting for equations.
  • Utility Functions

    • pretty_print_page_with_image() – inspect extracted results with annotated images.
    • show_comparison_view() – compare annotated vs. reconstructed content.
    • cleanup_pipeline() – reset all artifacts.

🚀 Installation

pip install readgrid

🛠️ Usage

Stage 1: Upload, Detect, and Edit

from readgrid import stage_1

stage_1()

Stage 2: Test Coordinates

from readgrid import stage_2

stage_2(
    row_id="ID_1",
    box_type="tables",
    box_index=0
)

Stage 3: Extract with Gemini

from readgrid import stage_3

stage_3(api_key="YOUR_API_KEY")

📦 Requirements


📄 License

MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

readgrid-0.1.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

readgrid-0.1.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file readgrid-0.1.1.tar.gz.

File metadata

  • Download URL: readgrid-0.1.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for readgrid-0.1.1.tar.gz
Algorithm Hash digest
SHA256 baf9c6ca8e2f937d9f95d30cc9d4156912e0e3f8c8d9f3b02093a497e54244cb
MD5 7ab9e3e2e9fb2c1c3759307b4148e730
BLAKE2b-256 ffe8d3b125b7523c3e09d333d0fe102a9538784151e68bee1c5030ff1c98f1b0

See more details on using hashes here.

File details

Details for the file readgrid-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: readgrid-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for readgrid-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b402ab08a6286f6b9449ac2543418fa763fc709896959cea0df2b40113704f5d
MD5 dcbb2f7a033cecfe4eac98a2ceee5a8c
BLAKE2b-256 55933bc02bb3c9da888392b6da8cb48aca02a0cc1c9223f6e89a3dbfd9d1381a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page