opticr
Python library to expose a single interface and API to few OCR tools (google vision, Tesseract)
Install
Required binaries available in the $PATH
poppler-utils (pdf2image)
https://github.com/Belval/pdf2image#how-to-install
tesseract
https://tesseract-ocr.github.io
Install OpticR
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("tesseract")
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("tesseract", 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)
Metadata
Release files for opticr 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opticr-0.2.0.tar.gz | 7.5 kB | Without provenance | Details for opticr-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opticr-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for opticr-0.2.0-py3-none-any.whl |
Total release size: 16.3 kB
Release files / opticr-0.2.0.tar.gz
| Download URL | opticr-0.2.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
000dc8decef7c447518d22ff6f8d696520abae65c6a2b545d1e66bf6701676bd
|
|
BLAKE2b-256 checksum How to use checksums |
2bce45d5ba1816c16c1263205823626af71fe3f0f97777037e7c0d5531c70636
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.10.1 Linux/5.10.102.1-microsoft-standard-WSL2
|
Release files / opticr-0.2.0-py3-none-any.whl
| Download URL | opticr-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b1d8b850084064f94aa54f359b60ec67468b1cd1ffa09870b18ae28ab0b5090
|
|
BLAKE2b-256 checksum How to use checksums |
6ba8a4b503548f1fb6182d2668f03548fc6b336b0b7934776954ac1e27b672e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.10.1 Linux/5.10.102.1-microsoft-standard-WSL2
|
Security for opticr 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.