Skip to main content

Official Python SDK for the OCRQueen document extraction API

Project description

ocrqueen-python

Official Python SDK for the OCRQueen document and image extraction API.

🚧 Status: Pre-release. APIs and surface area will change before v1.0.0.

Installation

pip install ocrqueen

Requires Python 3.10 or newer.

Supported formats

Category Formats
Documents PDF
Presentations PPTX, PPT (PowerPoint)
Images PNG, JPEG, WebP, HEIC / HEIF (iPhone photos)

The API returns structured JSON + Markdown for every supported type — text, tables, images, and (with extraction_profile="advanced") diagram graph extraction and image alt-text.

Quickstart

from ocrqueen import OCRQueen

client = OCRQueen(api_key="pk_...")

with open("paper.pdf", "rb") as f:
    job = client.extract.create(file=f)

result = client.jobs.wait(job)
print(result.result["markdown"])

Get an API key from dashboard.ocrqueen.com.

Other file types

# Slide decks — speaker notes are preserved
job = client.extract.create(file=open("pitch.pptx", "rb"))

# iPhone photos — HEIC handled natively, no conversion needed
job = client.extract.create(file=open("receipt.heic", "rb"))

# Scanned document images
job = client.extract.create(file=open("invoice.png", "rb"))

# Deeper extraction profile — diagrams, image alt-text, OCR on
# embedded text
job = client.extract.create(
    file=open("paper.pdf", "rb"),
    profile="advanced",
)

Patent extraction (domain="patent")

Route a PPTX or PDF through the patent-specific pipeline: region classification (cover / abstract / drawings / claims / references), Gemini cover parser, LibreOffice rasterisation for EMF/WMF figures, cross-figure numeral resolution, and an honest per-stage faithfulness_score. Billed flat at $0.05/page regardless of profile.

job = client.extract.create(
    file=open("invention-disclosure.pptx", "rb"),
    options={"domain": "patent"},
)
result = client.jobs.wait(job).result        # response shape changes — discriminator is `domain`
patent = result                              # full PatentExtractionResponse
print(patent["source"]["input_kind"])        # "invention_disclosure" | "published_patent" | "unknown"
print(patent["extraction"]["faithfulness_score"])

# Figures carry a stable proxy URL — never expires until the underlying
# object is purged by your retention window. fetch_image() handles the
# 302 → signed-storage dance for you and returns raw bytes.
for fig in patent["drawings"]:
    bytes_ = client.jobs.fetch_image(fig["image_url"])
    open(f"{fig['figure_number'].replace(' ', '_')}.png", "wb").write(bytes_)

The same fetch_image() helper works for general-domain ImageBlock URLs (pages[].blocks[].url) — useful for snapshotting all figures from a job into your own pipeline.

Documentation

License

MIT — see LICENSE.

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

ocrqueen-0.3.1.tar.gz (68.3 kB view details)

Uploaded Source

Built Distribution

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

ocrqueen-0.3.1-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file ocrqueen-0.3.1.tar.gz.

File metadata

  • Download URL: ocrqueen-0.3.1.tar.gz
  • Upload date:
  • Size: 68.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ocrqueen-0.3.1.tar.gz
Algorithm Hash digest
SHA256 265c98d921f6846d778a929160169f9783260810b71f5efa2cc6710d4c619a78
MD5 e66dee1aa3879faa86ca7966f1bd97b6
BLAKE2b-256 438c8a5fa7beff5295ae2c13455f65066f68c5eb6c71d8d1554acecadb053c1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocrqueen-0.3.1.tar.gz:

Publisher: release.yml on ocrqueen/ocrqueen-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ocrqueen-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: ocrqueen-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ocrqueen-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b599b285f72d3d6adda299d8cc24670c00b229f7973910a56f0d707c2b150cd3
MD5 0be3d84f8d89d93d0b7009d98b3f52a8
BLAKE2b-256 f6865d2042603bfb638901db39a87e84b990daa59b23ba27f1a0c2348c04f333

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocrqueen-0.3.1-py3-none-any.whl:

Publisher: release.yml on ocrqueen/ocrqueen-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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