Skip to main content

OCR support for Stache AI document loaders

Project description

stache-ai-ocr

OCR support for Stache AI document loaders.

Provides a high-priority PDF loader that falls back to OCR for scanned documents.

Installation

pip install stache-ai-ocr
apt install ocrmypdf  # System dependency required

Usage

Once installed, the OCR loader automatically registers and takes priority over the basic PDF loader for all PDF files.

The loader will:

  1. First attempt normal text extraction with pdfplumber
  2. If no text is found (scanned PDF), fall back to OCR using ocrmypdf
  3. Gracefully handle missing ocrmypdf (logs warning and returns empty text)

System Requirements

  • ocrmypdf system binary must be installed
    • Ubuntu/Debian: apt install ocrmypdf
    • macOS: brew install ocrmypdf
    • Includes Tesseract OCR engine

Priority Override

This loader registers with priority 10, overriding the basic PDF loader (priority 0). This ensures OCR is used when available without affecting systems where it's not installed.

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

stache_ai_ocr-0.1.3.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

stache_ai_ocr-0.1.3-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file stache_ai_ocr-0.1.3.tar.gz.

File metadata

  • Download URL: stache_ai_ocr-0.1.3.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for stache_ai_ocr-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f826ff9a875295000267e1ec1b451a77dfa7a3fc86b978abf550afd6feed7cd1
MD5 6267890db6628b88c006851e635de42a
BLAKE2b-256 4cd31bc177db18b01b1d537ace9791f32bfa96fd36e7fc6f7596997dd24c9206

See more details on using hashes here.

File details

Details for the file stache_ai_ocr-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: stache_ai_ocr-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for stache_ai_ocr-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 967f7f7d118ee0b76c97ce6c56916211112838c3bca3d83dd4ca8c34001fb117
MD5 77fed0b97bab392318ea58e731652999
BLAKE2b-256 290d4a5a3b1d4afccf3f300f0beedfae4ca857ab85eea987ce14d433f161e1b9

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