Skip to main content

📄 TinyDoc — AI Document Understanding in 3 Lines of Code

Extract answers, tables, and structured data from any document image.

PyPI GitHub HF Space License


What is this?

TinyDoc is a Python SDK powered by TinyDoc-VLM — a 256M parameter vision-language model trained specifically for document understanding. It runs on CPU with no GPU required.

Drop in a document image. Ask a question. Get the answer.


Install

pip install tinydoc

That's it. One package. ~1.1GB model weights auto-download from HuggingFace on first use.


Quick Start

from PIL import Image
from tinydoc import TinyDocExtractor

extractor = TinyDocExtractor()  # auto-detects device, loads from HF Hub
img = Image.open("invoice.png")

# 💬 Ask a question
result = extractor.ask(img, "What is the total amount?")
print(result.answer)  # "$1,234.56"

# 📋 Extract all fields as JSON
result = extractor.extract(img, output_format="json")
print(result.fields)  # {"vendor": "Acme Corp", "total": "$1,234.56", "date": "2024-01-15", ...}

# 📊 Extract tables to Markdown
result = extractor.extract_table(img)
print(result.markdown)
# | Item       | Qty | Price  |
# |------------|-----|--------|
# | Widget A   | 10  | $25.00 |
# | Widget B   | 5   | $50.00 |

What can it do?

Task How Example
VQA extractor.ask(img, "question") "What is the invoice date?"
JSON Extraction extractor.extract(img) Pulls all key-value pairs
Table Parsing extractor.extract_table(img) Converts tables to Markdown
OCR extractor.ask(img, "Transcribe the text") Plain text output
Key-Value Pairs extractor.extract(img, output_format="kv") Dict of field→value

Why TinyDoc?

GPT-4V Tesseract TinyDoc
Size ~2T params N/A 256M
Cost $0.01+/query Free Free
Runs on API only CPU CPU or GPU
Structured output Prompt-dependent None Native
Latency ~2-5s (API) <100ms <500ms
License Proprietary Apache 2.0 Apache 2.0

Advanced

extractor = TinyDocExtractor(
    device="cuda",           # or "cpu", "mps"
    model_name_or_id="eulogik/TinyDoc-VLM-256M",  # or local path
)

result = extractor.ask(
    img,
    "What are the line items?",
    max_new_tokens=256,      # override default 512
)

Links

Platform Link
🐍 PyPI pypi.org/project/tinydoc
🤗 Model Hub eulogik/TinyDoc-VLM-256M
🤗 Live Demo Space: eulogik/TinyDoc-VLM
📖 GitHub github.com/eulogik/TinyDoc-VLM
🌐 Website eulogik.github.io/TinyDoc-VLM
🐦 Twitter @eulogik

License

Apache 2.0 — free for commercial use.


Built by eulogik — AI infrastructure for document intelligence.

Release files for tinydoc 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for tinydoc 0.1.2
File Interpreter ABI Platform
tinydoc-0.1.2-py3-none-any.whl Python 3 none any Details

Release files / tinydoc-0.1.2-py3-none-any.whl

Download URL tinydoc-0.1.2-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
320e61a44fcf2bff2b08ef3486cfac382c7d260207ce4fb69db878a8a50d22ca
BLAKE2b-256 checksum
How to use checksums
93a8a5431a8f9023045c94038af8ef1ea6d5ef21b026930fb412e702e66bf9de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page