Skip to main content

Mon OCR

Optical Character Recognition for Mon (mnw) text.

Installation

pip install monocr | uv add monocr

Quick Start

Python Usage

from monocr import MonOCR

# Initialize. Downloads the model pinned in config.HF_REVISION on first use.
model = MonOCR()

# A page: segmented into lines, joined with newlines
print(model.predict_page("page.png"))

# A line crop: read whole, never split
print(model.predict_line("line.png"))

# With a confidence score
result = model.predict_with_confidence("page.png")
print(f"Text: {result['text']}")
print(f"Confidence: {result['confidence']:.2%}")

predict and read_text are aliases for predict_page. If you are passing single-line crops, call predict_line — it is the only path that cannot split one line into several.

Examples

See the examples/ folder to learn more.

  • examples/run_ocr.py: A complete script that can process a folder of images or read a full PDF book.
  • Or a demo notebook to play around with the package notebooks/demo.ipynb

CLI Usage

You can also use the command line interface:

# Process a single image
monocr read image.png

# Process a folder of images
monocr batch folder/path

# Manually download the model
monocr download

Resources

Development

uv sync
uv run pytest

Release Workflow

The tag has to match [project.version] in pyproject.toml. The release workflow checks, and fails the build if it does not — this section used to show git tag v2.2.3 next to a version of 2.2.0, and nothing would have stopped that going out.

uv version --bump patch          # or minor / major
git commit -am "release: $(uv version --short)"
git tag "v$(uv version --short)"
git push origin HEAD --tags

Publishing runs from the tag, through GitHub Actions, using PyPI trusted publishing. It installs from the lockfile and runs the test suite first.

License

MIT - do whatever you want with it.

Download files

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

Source Distribution

monocr-2.3.0.tar.gz (117.7 kB view details)

Uploaded Source

Built Distribution

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

monocr-2.3.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file monocr-2.3.0.tar.gz.

File metadata

  • Download URL: monocr-2.3.0.tar.gz
  • Upload date:
  • Size: 117.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for monocr-2.3.0.tar.gz
Algorithm Hash digest
SHA256 9138f0435ea0aecb475a47a0561ccda72a8087b000b6d32d411e1b05e0fa3caf
MD5 614850765e48f6195ef6a40dcecd43ed
BLAKE2b-256 9b831f043a91b05b5765cfdfb7ccc165c4c04da23cbbdb43058217878d5b434f

See more details on using hashes here.

File details

Details for the file monocr-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: monocr-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for monocr-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ed163d4dc53f9816689eb36c47cf1961ae7f83c91e2d73d65d6107bb77a7ada
MD5 a4e28e695264a03db5439b82eb1030b6
BLAKE2b-256 7b59be2b3cc2272c2b4402ec751c723290e2ea2fb988ed8830809f35ab7afea4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.3.0 This release

2 files

2.2.0

2 files

2.1.2

2 files

2.1.1

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.8

2 files

0.1.3

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page