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.1.0 are published for:

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

Intel macOS is not included in the 0.1.0 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.

⚙️ 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-OCRv5 Mobile 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

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.1.0 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.kaneki.cz
Rust package: crates.io/crates/glypho-ocr
Node.js package: npmjs.com/package/glypho-ocr
License: Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glypho_ocr-0.1.0.tar.gz (83.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

glypho_ocr-0.1.0-py3-none-win_arm64.whl (18.9 MB view details)

Uploaded Python 3Windows ARM64

glypho_ocr-0.1.0-py3-none-win_amd64.whl (19.7 MB view details)

Uploaded Python 3Windows x86-64

glypho_ocr-0.1.0-py3-none-manylinux_2_28_x86_64.whl (22.6 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

glypho_ocr-0.1.0-py3-none-manylinux_2_28_aarch64.whl (23.6 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

glypho_ocr-0.1.0-py3-none-macosx_14_0_universal2.whl (18.4 MB view details)

Uploaded Python 3macOS 14.0+ universal2 (ARM64, x86-64)

File details

Details for the file glypho_ocr-0.1.0.tar.gz.

File metadata

  • Download URL: glypho_ocr-0.1.0.tar.gz
  • Upload date:
  • Size: 83.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for glypho_ocr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b1013e20b5488fbffd200a1cd3044fa966d2275ea13682b70d8752d1b25bb367
MD5 f951e0ceb220126d1fbbf671b912cf3b
BLAKE2b-256 bf0cb8bbc2675c8efd77912acf78191bc5af3a3da38bf5b45fe950ae881e4a8f

See more details on using hashes here.

File details

Details for the file glypho_ocr-0.1.0-py3-none-win_arm64.whl.

File metadata

  • Download URL: glypho_ocr-0.1.0-py3-none-win_arm64.whl
  • Upload date:
  • Size: 18.9 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for glypho_ocr-0.1.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 81746434c1864b584753d55eda72c8593b536c208e81b7793fbdc51f5a4920ee
MD5 f4a407b67c8fcce867ce6f555061b707
BLAKE2b-256 f7330657856fe32cc3073a2602817da0fbae2ea90e9eec09c8ecaf43ffb693d3

See more details on using hashes here.

File details

Details for the file glypho_ocr-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: glypho_ocr-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 19.7 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for glypho_ocr-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 7fe545d670018ce9ee62d938c7b38364d3a0da464351f85d60462daf774cfa86
MD5 f571e566fa446494c7d77c4f4bcb1fe6
BLAKE2b-256 fc435beba9d2580e4dff5a9ab506e851a36bfb6be1ae5874e64310a495cf3755

See more details on using hashes here.

File details

Details for the file glypho_ocr-0.1.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for glypho_ocr-0.1.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 03c6c1b3d830a6950964a5c324f35e6ea7e6177b6f5528978abc36445d4a8789
MD5 edb40cf3613febb95a7d3565c96f0df5
BLAKE2b-256 39a6a4d252fee3b5ad541c06ad0521a4701f32056629b183a7d23329c2deb906

See more details on using hashes here.

File details

Details for the file glypho_ocr-0.1.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for glypho_ocr-0.1.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 22dec78af25175260844145d6eb7e76c516840d392425add10fdd45b62559ea5
MD5 703445c9b4be7205ee5a5dbb349764a9
BLAKE2b-256 9f662086c50efe250e95fcc96fd848e8796973e745841a71354fa221aefe92a7

See more details on using hashes here.

File details

Details for the file glypho_ocr-0.1.0-py3-none-macosx_14_0_universal2.whl.

File metadata

File hashes

Hashes for glypho_ocr-0.1.0-py3-none-macosx_14_0_universal2.whl
Algorithm Hash digest
SHA256 f3caf03b63da93810c9ffcf41f3a15a1dcd9ae596aebab411748e86cec550761
MD5 eedf4503ff781b581dfde4f1c9f7160b
BLAKE2b-256 46ae099dacd9420f9b88f426ba48cbb11c41225052b368a0700be9c3848f721b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

6 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