Skip to main content

expose a single interface and API to few OCR tools

Project description

opticr

Python library to expose a single interface and API to few OCR tools (google vision, Textract)

Install

With pip

pip install opticr

With poetry

poetry add opticr

or to get the latest 'dangerous' version

poetry add  git+https://github.com/lzayep/opticr@main

Usage

from opticr import OpticR

ocr = OpticR("textract")
pathtofile = "test/contract.pdf
pages: list[str] = ocr.get_pages(pathtofile)

With google-vision:

from opticr import OpticR

ocr = OpticR("google-vision", options={"google-vision": {"auth": {"token": ""}}})

# file could come from an URL
pathtofile = "https://example.com/contract.pdf
pages: list[str] = ocr.get_pages(pathtofile)

Cache the result, if the file as already been OCR return immediatly the previous result. Result are stored temporarly in the local storage or shared storage such as Redis.

from opticr import OpticR

ocr = OpticR("textract", options={"cache":
                         {"backend": "redis", redis: "redis://"}}

# file could come from an URL
pathtofile = "https://example.com/contract.pdf
pages: list[str] = ocr.get_pages(pathtofile, cache=True)

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

opticr-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

opticr-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file opticr-0.1.0.tar.gz.

File metadata

  • Download URL: opticr-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.1 Linux/5.10.102.1-microsoft-standard-WSL2

File hashes

Hashes for opticr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 184fde7013123ad1f49c196d8a184f7b61d0104d40ce0d50d302054a098fc945
MD5 673bd1f4822c96d7f25db357c42bd46b
BLAKE2b-256 76450dc0550d2deab3024707ae5d5f85572bebae137bc4b1ea6549405cc9d4c7

See more details on using hashes here.

File details

Details for the file opticr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: opticr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.1 Linux/5.10.102.1-microsoft-standard-WSL2

File hashes

Hashes for opticr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1df480587854f09b0c3fcadfa7a3323a7fcfb848eca597e678bb36e955410251
MD5 881a41fcd24c115a837235433bff067b
BLAKE2b-256 dc9aa622a83af6046fe4f463b3cfd150967ac29a3a3541089d361b9b0ec4080c

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