Skip to main content

Glypho for Python

Fast multilingual OCR for Python with a bundled native runtime.
Local-first, Python 3.10+, and powered by the same Rust + ONNX Runtime engine as Glypho for Rust and Node.js.

PyPI Python GitHub License

🌐 Try Glypho Web · GitHub

Glypho's Python package calls the bundled native Rust library directly through a stable C ABI. It does not start a new OCR subprocess for every image, so ONNX Runtime sessions and loaded models can stay warm inside the Python process.

No OCR cloud account, API key, Rust toolchain or separately installed libglypho is required when a prebuilt wheel is available for your platform.

📦 Install

pip install glypho-ocr

The package name is glypho-ocr; import it as glypho:

from glypho import Glypho

Prebuilt wheels for 0.2.1 are published for:

OS Architectures
Linux x64, ARM64
macOS Apple Silicon (ARM64)
Windows x64, ARM64

Intel macOS is not included in the 0.2.1 prebuilt-wheel matrix. On targets without a matching wheel, pip may fall back to the source distribution, which requires Rust/Cargo and is not covered by the prebuilt release matrix.

🚀 Quick start

from glypho import Glypho

ocr = Glypho(
    quality="balanced",
    device="auto",
)

document = ocr.recognize("screenshot.png")
print(document.text)

Leaving languages empty enables automatic native routing. If you already know what to expect, pass language hints:

ocr = Glypho(
    languages=("en", "ja"),
    quality="accurate",
)

document = ocr.recognize("mixed.png")

Common BCP-47-style values such as cs-CZ, de-DE, ko-KR, zh-Hans, jpn and rus are normalized automatically.

Encoded bytes, Pillow images and NumPy arrays can be recognized in memory through the same persistent native runtime:

document = ocr.recognize(image_bytes, file_name="capture.png")
document = ocr.recognize(pillow_image, file_name="capture.png")
document = ocr.recognize(rgb_array, file_name="frame.png")

Pillow remains optional and is only needed for Pillow/NumPy inputs.

⚙️ Options

ocr = Glypho(
    quality="balanced",       # fast | balanced | accurate | maximum
    device="auto",            # auto | cpu | cuda | coreml | openvino
    languages=(),              # () = automatic routing
    threads=None,
    offline=False,
    models=None,
)

Per-request options can override the defaults:

document = ocr.recognize(
    "image.png",
    languages=["en", "ru"],
    segmentation="sparse_text",
    min_confidence=0.8,
    timeout=30.0,
)

Segmentation modes:

auto | single_block | single_line | sparse_text

🎯 Quality profiles

Profile Detector Primary recognizer Use case
fast PP-OCRv6 Tiny PP-OCRv6 Tiny minimum latency
balanced PP-OCRv6 Small PP-OCRv6 Small default OCR
accurate PP-OCRv6 Small PP-OCRv6 Small smaller / harder text
maximum PP-OCRv6 Medium PP-OCRv6 Medium accuracy-first workloads

Glypho exposes 55 canonical language identifiers across Latin, Eastern Slavic, Chinese, Japanese and Korean routes.

🔥 Warm sessions

Independent detector and recognizer sessions initialize concurrently and remain resident for later calls.

For repeated OCR, create one Glypho instance and warm it before processing requests:

from glypho import Glypho

ocr = Glypho(languages=("en", "cs"))
ocr.warmup()

first = ocr.recognize("first.png")
second = ocr.recognize("second.png")

print(first.text)
print(second.text)

You can also warm the complete decode → detect → recognize path with a representative image:

ocr.warmup(sample="sample.png", languages=["en"])

info() reports the configured and resolved runtime/device information:

print(ocr.info())

📐 Structured results

recognize() returns an immutable Document, not just a string:

document = ocr.recognize("image.png")

print(document.text)

for line in document.lines:
    print(line.text)
    print(line.confidence)
    print(line.language, line.script)
    print([(point.x, point.y) for point in line.quad.points])

Useful fields include:

  • document.text — ordered plain text;
  • document.lines — detected text lines;
  • line.quad.points — source-image quadrilateral coordinates;
  • line.confidence — recognition confidence;
  • line.language / line.script — routed metadata when known;
  • line.alternatives — rejected candidate when available;
  • document.to_dict() — complete JSON-compatible result.

⚡ Hardware acceleration

Available device targets are:

auto | cpu | cuda | coreml | openvino

Provider availability depends on the wheel, platform and host runtime. device="auto" probes available accelerators and falls back to CPU when necessary; info() exposes the resolved device and fallback information.

The 0.2.1 release builds are CUDA-aware on Linux/Windows x64 and CoreML-aware on macOS Apple Silicon. CPU remains the fallback path.

🧩 CLI

The Python wheel also installs the native glypho executable:

glypho screenshot.png \
  --language en,ja \
  --quality balanced \
  --device auto

Runtime information:

glypho info --pretty

JSON output:

glypho screenshot.png --format json --output result.json

💾 Models and offline mode

Missing model files are downloaded from pinned revisions, verified with SHA-256 and cached under:

~/.glypho-ocr/models

Use another location with GLYPHO_HOME, GLYPHO_MODELS or the models argument.

To prohibit model downloads completely:

ocr = Glypho(offline=True)

🔒 Local-first

OCR inference runs locally. Glypho does not upload input images to an OCR API.

The only network access normally needed is the first model download. Once the required models are cached, recognition can run offline.


Python guide: docs/PYTHON.md
Full project: github.com/rinqaku/Glypho
Web preview: glypho.rinqaku.dev
Rust package: crates.io/crates/glypho-ocr
Node.js package: npmjs.com/package/glypho-ocr
License: Apache-2.0

Metadata

Release files for glypho-ocr 0.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 glypho-ocr 0.2.1
File Size Uploaded Provenance Actions
glypho_ocr-0.2.1.tar.gz 92.3 kB Without provenance Details for glypho_ocr-0.2.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for glypho-ocr 0.2.1
File Actions
glypho_ocr-0.2.1-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details for glypho_ocr-0.2.1-py3-none-win_arm64.whl
glypho_ocr-0.2.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for glypho_ocr-0.2.1-py3-none-win_amd64.whl
glypho_ocr-0.2.1-py3-none-manylinux_2_39_x86_64.whl Python 3 none Linux glibc 2.39+ x86-64 Details for glypho_ocr-0.2.1-py3-none-manylinux_2_39_x86_64.whl
glypho_ocr-0.2.1-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for glypho_ocr-0.2.1-py3-none-manylinux_2_28_x86_64.whl
glypho_ocr-0.2.1-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for glypho_ocr-0.2.1-py3-none-manylinux_2_28_aarch64.whl
glypho_ocr-0.2.1-py3-none-macosx_14_0_universal2.whl Python 3 none macOS 14.0+ universal2 (ARM64, x86-64) Details for glypho_ocr-0.2.1-py3-none-macosx_14_0_universal2.whl

Total release size: 199.4 MB

Release files / glypho_ocr-0.2.1.tar.gz

Download URL glypho_ocr-0.2.1.tar.gz
Size 92.3 kB
Tags Source
SHA-256 checksum
How to use checksums
97877b40e7776f6884d1c6691db7bdb0fa6bba9755aba44e3cc2404c57e0d4db
BLAKE2b-256 checksum
How to use checksums
b915b02e2043fe6dad8a4d8b78f96b96b2b6fc7bc27f23040bd5f85be9446c39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / glypho_ocr-0.2.1-py3-none-win_arm64.whl

Download URL glypho_ocr-0.2.1-py3-none-win_arm64.whl
Size 19.2 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
00ec2b27df05796cdc5f794a9d0fca6b3f14c102e0abfb9e59d6842ab4bd8a0d
BLAKE2b-256 checksum
How to use checksums
aa63000df580730d253f617fe7031a5b846bf5c3c6633e66c012ff4876b1196b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / glypho_ocr-0.2.1-py3-none-win_amd64.whl

Download URL glypho_ocr-0.2.1-py3-none-win_amd64.whl
Size 55.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
5585204bf189b0fe4c4e0974bc756402aa221a13f62176e1e323c54c04b4df0d
BLAKE2b-256 checksum
How to use checksums
dfaa87a027e6eab53b340634528bf3c6d9c0a8504b2b8417ed5726599f3081f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / glypho_ocr-0.2.1-py3-none-manylinux_2_39_x86_64.whl

Download URL glypho_ocr-0.2.1-py3-none-manylinux_2_39_x86_64.whl
Size 59.9 MB
Tags Linux glibc 2.39+ x86-64 Python 3
SHA-256 checksum
How to use checksums
201e99958ca6b698f95be802314a94a4d21048773dd59ff31a76c8bad016013d
BLAKE2b-256 checksum
How to use checksums
aa3c1b90181e0f5efd8c0158cbad4215692ce306c1446b465d6bb5ee3f03b5a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / glypho_ocr-0.2.1-py3-none-manylinux_2_28_x86_64.whl

Download URL glypho_ocr-0.2.1-py3-none-manylinux_2_28_x86_64.whl
Size 22.6 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
37dc0537a6240875c27a2512903b61690be8b68c0079d5a49d88152d3361f128
BLAKE2b-256 checksum
How to use checksums
2fc52aab02db317454f6c67f229c0c6e920c69bb682f8050bcdfaf86359c4b28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / glypho_ocr-0.2.1-py3-none-manylinux_2_28_aarch64.whl

Download URL glypho_ocr-0.2.1-py3-none-manylinux_2_28_aarch64.whl
Size 23.8 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
4e7467ae449c8d0ba8659a6ab89c22ad9dd5d58490eee0d043f0cd828db0b92d
BLAKE2b-256 checksum
How to use checksums
ea78083cde20bd9264898b8c8c88a5866039a6f2c918bc56e99e53eeea6057f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / glypho_ocr-0.2.1-py3-none-macosx_14_0_universal2.whl

Download URL glypho_ocr-0.2.1-py3-none-macosx_14_0_universal2.whl
Size 18.6 MB
Tags Python 3 macOS 14.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
aaa4d298b80be9c37859eb5184eddf2b56f7537c432f487ce7f130af5ccfc193
BLAKE2b-256 checksum
How to use checksums
574b79e149dc6748cab56a0506d79b6c3e361f30f5d5d3528f6549037ce4a220
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for glypho-ocr 0.2.1

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.

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