Python frontend and native C/Metal inference engine for baidu/Unlimited-OCR
Project description
unlimitedocr.c
unlimitedocr.c runs the baidu/Unlimited-OCR model locally with a native C/Metal
inference engine and a small Python API for OCR workflows.
Python handles the user-facing pieces — image loading, prompt construction, tokenization, and text decoding. The native library handles model loading, memory management, KV cache, logits processing, and GPU execution.
Quick start
from unlimitedocr_c import UnlimitedOCR
ocr = UnlimitedOCR()
text = ocr.generate("page.png")
print(text)
ocr.close()
Create one UnlimitedOCR instance, reuse it for as many images as you want, and
call close() when finished.
from unlimitedocr_c import UnlimitedOCR
ocr = UnlimitedOCR()
for image_path in ["page-1.png", "page-2.png", "page-3.png"]:
print(ocr.generate(image_path, profile="base"))
ocr.close()
Input types
generate() accepts the common image forms directly:
| Input type | Example |
|---|---|
| local path | ocr.generate("page.png") |
| URL | ocr.generate("https://example.com/page.jpg") |
| bytes | ocr.generate(open("page.png", "rb").read()) |
| file-like object | ocr.generate(BytesIO(image_bytes)) |
| PIL image | ocr.generate(Image.open("page.png")) |
| base64/data URI string | ocr.generate("data:image/png;base64,...") |
Example:
from io import BytesIO
from PIL import Image
from unlimitedocr_c import UnlimitedOCR
ocr = UnlimitedOCR()
text_from_path = ocr.generate("page.png")
text_from_url = ocr.generate("https://example.com/page.jpg")
text_from_bytes = ocr.generate(open("page.png", "rb").read())
text_from_file = ocr.generate(BytesIO(open("page.png", "rb").read()))
text_from_pil = ocr.generate(Image.open("page.png"))
ocr.close()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unlimitedocr_c-0.2.1-py3-none-macosx_12_0_arm64.whl.
File metadata
- Download URL: unlimitedocr_c-0.2.1-py3-none-macosx_12_0_arm64.whl
- Upload date:
- Size: 358.6 kB
- Tags: Python 3, macOS 12.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e253dccdd8165d2fe5a3d4caed163d545c234a26984602b5a0208c783dc4a996
|
|
| MD5 |
b3cb3ac13df74cb4392f3c24abbfd890
|
|
| BLAKE2b-256 |
10e5637df40445a323d9baafde2425dca4c37298344083cf5e52a8d85ab913a1
|