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.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

tinydoc-0.1.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file tinydoc-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tinydoc-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for tinydoc-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 320e61a44fcf2bff2b08ef3486cfac382c7d260207ce4fb69db878a8a50d22ca
MD5 a068b044c34c6f3d54a78f0a99199832
BLAKE2b-256 93a8a5431a8f9023045c94038af8ef1ea6d5ef21b026930fb412e702e66bf9de

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