TextLens
OCR without the OCR complexity.
Read text from images and PDFs with one line of Python — on a laptop, a Raspberry Pi or a GPU server.
Website · Documentation · Examples · Changelog
Install
pip install textlens-ocr
Python 3.10+. No CUDA or PyTorch needed. The first run downloads a small OCR model (~31 MB) automatically.
Use it
1. Get the text
from textlens import OCR
result = OCR()("invoice.pdf")
print(result.text)
2. Export it
result.to_markdown() # headings, lists, tables
result.to_json() # pages, blocks, bounding boxes, confidence
result.save("output/") # .json, .md, .txt and tables as .csv
3. Or use the command line
textlens ocr invoice.pdf # print the text
textlens ocr invoice.pdf -f markdown -o invoice.md
textlens inspect invoice.pdf # which pages actually need OCR
textlens doctor # check your setup
That's it. For PDFs, TextLens reads the built-in text of each page directly and only runs OCR on scanned pages, so it's fast and exact.
Pick speed or accuracy (optional)
OCR(profile="edge") # small devices (Raspberry Pi, Jetson)
OCR(profile="fast") # default on most computers
OCR(profile="accurate") # use the best model you have installed
OCR(model="glm-ocr") # choose a specific model
Bigger models (for tables, formulas, complex layouts) need a GPU:
pip install "textlens-ocr[gpu]"
textlens models list
textlens models install glm-ocr
More features
| Feature | Install | Try |
|---|---|---|
| REST API | pip install "textlens-ocr[server]" |
textlens serve |
| Word / PowerPoint files | pip install "textlens-ocr[documents]" |
textlens ocr slides.pptx |
| Number-plate recognition | pip install "textlens-ocr[anpr]" |
textlens anpr car.jpg --region in |
| Extract fields to JSON | — | textlens extract invoice.pdf -s "invoice_number,date,total" |
| Many files | — | textlens batch ./documents -o results/ |
| Docker | — | docker build -f deploy/docker/Dockerfile -t textlens . |
Documentation
- Quickstart · Installation · Troubleshooting
- How it works · Models · API reference
- PDFs · RAG · Edge devices · Server · Docker
- Examples · Upgrading from 0.x · Changelog
Development
git clone https://github.com/Srevarshan05/textlens.git
cd textlens
pip install -e ".[dev]"
pytest
License
MIT. OCR models are downloaded separately under their own licenses
(textlens models info <model>). See THIRD_PARTY_NOTICES.md.
Metadata
Release files for textlens-ocr 2.0.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 |
|---|---|---|---|---|
| textlens_ocr-2.0.0.tar.gz | 335.6 kB | Without provenance | Details for textlens_ocr-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| textlens_ocr-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for textlens_ocr-2.0.0-py3-none-any.whl |
Total release size: 604.2 kB
Release files / textlens_ocr-2.0.0.tar.gz
| Download URL | textlens_ocr-2.0.0.tar.gz |
|---|---|
| Size | 335.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcfd3d1ba99469bbf9b5c5947b6fc55c103f3a97e24e253e289c6ee773325012
|
|
BLAKE2b-256 checksum How to use checksums |
ad5e326cda1b32b52f764bd71f2b81fbf7f12dde11dbacc03e59514d52c62753
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Release files / textlens_ocr-2.0.0-py3-none-any.whl
| Download URL | textlens_ocr-2.0.0-py3-none-any.whl |
|---|---|
| Size | 268.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95dff556ebb8506b34c8f71f73ee96864b18cf3defc8ea656c8019bfc836916f
|
|
BLAKE2b-256 checksum How to use checksums |
f49a5451088dd9ea96cfd6ec871a584e294dd3b986389ade6809e087f290dd75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Security for textlens-ocr 2.0.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.