Skip to main content

Tesela

Fast document OCR and ONNX inference on ordinary CPUs, written in Rust.

Tesela is a CPU inference engine written in Rust that runs ONNX models and a complete OCR pipeline (page decoding, text detection, recognition, line orientation and page unwarping) with no ONNX Runtime or PaddlePaddle at run time. This package is its Python extension: the module tesela. It is also the optional fastest engine of LegereOCR.

Two different measurements, on a Ryzen 9 9900X, so do not compare them with each other. This Python package: inside LegereOCR's Python pipeline (LEGERE_MOTOR=pagina) a page takes 0.427 s against 0.719 s with ONNX Runtime. The tesela command-line binary, which this wheel does not include: it takes 0.294 s on a full OCR page against 0.739 s for LegereOCR on ONNX Runtime; that figure is the binary alone, without the Python pipeline around it. The Results section of the repository gives every measurement, its memory and what it measures.

Status: early public version (0.0.2). Error messages and identifiers are in Spanish.

Install

pip install tesela

Wheels for Python 3.12 or later on Windows x64 and Linux x64 (glibc). On other platforms pip tries to build it from the source distribution, which needs a recent stable Rust toolchain; only Windows x64 and Linux x64 are tested. The instruction set is chosen when it runs (AVX-512, AVX2+FMA or scalar); force a lower one with TESELA_ISA=avx2 or TESELA_ISA=escalar.

With LegereOCR

pip install legereocr tesela
$env:LEGERE_MOTOR = "pagina"      # then run LegereOCR as usual
legere ocr page.png --json out.json

LEGERE_MOTOR=auto (the default) never loads Tesela: it is opt-in.

This wheel installs the Python module only; it does not include the tesela command-line tool. Build the CLI from source (cargo build --release -p cli, see the repository README).

On its own

It reads the OCR models from a folder (see Models; the downloader of LegereOCR fetches them and checks every hash: python -m legereocr.motores.descarga with no arguments; that also fetches the page-orientation model that LEGERE_MOTOR=pagina needs in addition to the four Tesela reads: det_v6_tiny rec_latin ori_linea uvdoc).

import cv2, tesela

page = tesela.Pagina("modelos", hilos=8)   # folder with the OCR models
result = page.ocr(cv2.imread("page.png"))  # BGR uint8 array, H x W x 3
for text, confidence in zip(result["textos"], result["confianzas"]):
    print(f"{confidence:.2f}  {text}")

opencv-python is only for reading the image in this example (on a server or in a slim container, where import cv2 fails with libxcb.so.1/libGL.so.1 missing, install opencv-python-headless instead); any BGR uint8 array works.

More

The repository has the full README, the command-line tool, the build from source and the measurements: github.com/tesela-engine/tesela. Licensed under the Apache License 2.0; each OCR model keeps its own licence. The package carries NOTICE and THIRD-PARTY-LICENSES.txt with the code and crates it includes.

Metadata

Release files for tesela 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tesela 0.0.2
File Size Uploaded Provenance Actions
tesela-0.0.2.tar.gz 1.4 MB Without provenance Details for tesela-0.0.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tesela 0.0.2
File Interpreter ABI Platform Actions
tesela-0.0.2-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for tesela-0.0.2-cp312-abi3-win_amd64.whl
tesela-0.0.2-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for tesela-0.0.2-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Total release size: 6.5 MB

Release files / tesela-0.0.2.tar.gz

Download URL tesela-0.0.2.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
3d27a756290e4697d43fc399dd49b12129271e5acbbec8e2246cedd606fe8cf0
BLAKE2b-256 checksum
How to use checksums
12c3b7d9e88030c6bcf5012b374b0ec76957785e2338c3d414786fad52ae633b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / tesela-0.0.2-cp312-abi3-win_amd64.whl

Download URL tesela-0.0.2-cp312-abi3-win_amd64.whl
Size 2.6 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
131d30bdd953a2f5ed3b15c895812f9c8fc02f5b525b31465a4ed1bc41b59eef
BLAKE2b-256 checksum
How to use checksums
e4a3feee7e0232cce48362c416535f8f455cda21a49a29cc12f6a7132e1b3608
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / tesela-0.0.2-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL tesela-0.0.2-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 2.5 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
471bd8fa885ef4b384f85d895e1aac2a21936f0464e46b9c500b3306ece3e58f
BLAKE2b-256 checksum
How to use checksums
748c5329b8e318ce4bdf3110f7dc3d609f9128f0d4f0270444777ac035103f4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for tesela 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

3 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page