Skip to main content

textrieve

Image & PDF → text, free & fully open source.

Drop in an image or a PDF — get clean text. Offline OCR on your own CPU, with a CLI, a REST API, and a polished browser UI. No accounts, no API keys, no paywalls, nothing stored server-side.

Try it live GitHub stars Release Python 3.10+ FastAPI CI Apache-2.0

Status: v1.2.0 — multi-page PDF → text, language hints, auto-expiring results (2 min), live progress bar. Hosted: textrieve.onrender.com — UI + REST API on one free instance.


Why textrieve?

Pain point textrieve solves it
Paid OCR APIs, usage quotas 100% free — RapidOCR (ONNX) runs locally, MIT-licensed engine, bundled models
Privacy leaks to third parties Images never leave your machine / server — no telemetry, no storage
Account walls & signups No accounts. pip install, run, done.
Janky one-off tools A real web UI, a REST API, and a CLI in one repo

Contents


Quickstart

From PyPI (once published):

pip install textrieve
textrieve scan.png          # image
textrieve big.pdf --lang en # PDF

From source:

git clone https://github.com/dsk-dev-ai/textrieve
cd textrieve
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

uvicorn app:app --host 0.0.0.0 --port 8080

Open http://localhost:8080.


Web UI

Drag and drop an image or PDF (or click to browse) → preview → Extract text → copy or download.

  • Dark, responsive interface — works on desktop and mobile
  • Live progress bar (percent + elapsed time) while text is extracted
  • PDFs are extracted page-by-page, each one labelled [Page N]
  • Live 2-minute countdown on results; the page is wiped clean automatically
  • Engine status indicator in the header; GitHub + Sponsor links in the footer
  • No cookies, no tracking pixels, no third-party scripts

REST API

Method Endpoint Description
GET /api/health App version, OCR engine, live concurrency stats
POST /api/ocr Multipart file upload → text + confidence + timing
curl -F "file=@photo.png" http://localhost:8080/api/ocr
curl -F "file=@scan.pdf" "http://localhost:8080/api/ocr?lang=en"   # PDF, language hint
{
  "text": "HELLO TEXTRIEVE 2026",
  "confidence": 97.5,
  "engine": "RapidOCR (ONNX, CPU)",
  "duration_ms": 231.4
}

For PDFs the response also includes "pages" and the text is split with [Page N] markers. The optional lang query hints the OCR engine (e.g. en, ch, japan, korea).

Limits (free-tier friendly): PNG / JPG / WEBP / BMP / TIFF / PDF · up to 12 MB · up to 25 PDF pages · oversize or bad-type uploads rejected with clear HTTP errors (415 / 413 / 503 under load).

PDFs on the free hosted tier are slow: pages are OCR'd one-by-one at roughly 30–60 s per page on Render's free CPU. A 1–2 page scan fits fine; bigger documents should be split or OCR'd locally (pip install textrieve; textrieve big.pdf).


CLI

python cli.py scans/receipt.jpg        # print extracted text
python cli.py scan.pdf --lang en       # OCR a PDF, hint the language
python cli.py a.png b.png --json      # machine-readable output
python cli.py ./documents/            # OCR every image/PDF in a folder

Privacy & auto-expiry

  • Server-side: each request is decoded, processed in memory, then released. Results are never stored — no database, no cache of extracted text.
  • Client-side: extracted text is automatically erased 2 minutes after extraction (live countdown shown). Closing the tab clears everything.
  • Zero tracking: no analytics scripts, no fingerprinting.

Free-tier deployment

One free Render instance hosts both the web UI and the REST API — a static front-end isn't needed.

Render (UI + API in one service)

# 1. Use the included render.yaml
# 2. New → Blueprint → connect this repo → Deploy

Or manually: build pip install -r requirements.txt, start uvicorn app:app --host 0.0.0.0 --port $PORT --workers 1, health check at /api/health.

render.yaml and a Dockerfile are included; the health check keeps the free instance awake longer and restarts it cleanly after the idle timeout. The UI is plain HTML/CSS/JS served by FastAPI — the front-end talks to the OCR API on the same origin.

One-click deploy (free tier):

Deploy to Render

Honest note: on Render's free tier a single CPU does roughly a few OCR passes per second max. The built-in concurrency guards (2 parallel inferences, bounded queue) keep it alive under bursts rather than letting memory pile up — a 1000-request/second crowd needs a paid instance, but a 1000+ users day flows through one free box fine. Free instances also spin down after ~15 minutes idle; the UI auto-retries the first cold request.


Memory management

Optional — included by default:

  • ocr.py releases the decoded image array immediately after inference and runs periodic GC
  • Images larger than 4000 px or 4 Mpx are downscaled before OCR
  • app.py limits concurrent ONNX inference to 2 and refuses (503) past a bounded queue — the process stays under ~512 MB on a busy day

Tests

python -m pytest -q

The suite generates its own fixture files (no external sample downloads) and covers: health, UI + favicon serving, real image and multi-page PDF OCR round-trips with confidence, blank images, invalid/missing/oversized uploads, and CLI loading. Gated in CI (GitHub Actions, Python 3.11/3.12).


Roadmap

  • Batch queue in the web UI
  • PaddleOCR engine switch (even higher accuracy)
  • Searchable PDF export (text layer baked in)

Support

Built by @dsk-dev-ai. If textrieve saves you time, sponsor the project:

Sponsor


License

Apache-2.0. The RapidOCR engine is MIT-licensed; its ONNX models are distributed on an Apache-2.0 basis.

Release files for textrieve 1.2.1

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

Source distribution (sdist)

Source distribution for textrieve 1.2.1
File Size Uploaded
textrieve-1.2.1.tar.gz 31.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for textrieve 1.2.1
File Interpreter ABI Platform
textrieve-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 59.2 kB

Release files / textrieve-1.2.1.tar.gz

Download URL textrieve-1.2.1.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3a01c5d3ed5902d91b9c0a5f6ca87e163aa5d5cf0596c2dd5276a5b1fa4dfc44
BLAKE2b-256 checksum
How to use checksums
8f32425c74d4c6309b829a7b3ad489b21506b4cf2da1656711691c0726fe4cc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / textrieve-1.2.1-py3-none-any.whl

Download URL textrieve-1.2.1-py3-none-any.whl
Size 27.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
189d780e3898b4d0ea0927495e12034baa86740a0668eb3e707839996915bde8
BLAKE2b-256 checksum
How to use checksums
65deaea44bb237c89026d6a8f61caf4639e1eb3c7e8088742d734c92d44ac53c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

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