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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file readgrid-0.1.2.tar.gz.
File metadata
- Download URL: readgrid-0.1.2.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be09d188a0ba60208c3484b134cbed6b95caaa550e80e6d35d3ec408d7ff77c3
|
|
| MD5 |
66a8e0b598c3f23fe10d1ba9b4245c03
|
|
| BLAKE2b-256 |
33e35d785e314f81f8aae597c74a58e30cd8b0d5fcb246470401fc4d02a15c68
|
File details
Details for the file readgrid-0.1.2-py3-none-any.whl.
File metadata
- Download URL: readgrid-0.1.2-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4fcc98acde175e84c3e9f734d9e3ef317dd99ea1b23aa636f8d84de0a7ae7aa
|
|
| MD5 |
e7307f98adf97d5b13cd2f716ed36f0f
|
|
| BLAKE2b-256 |
4309c33400d1961419ad9e1ebbaa6a6fd449c3c2791c6234558fdadfdb1e9862
|