Files
rapidocr/python/demo.py
Cursor AgentandDaniel 3622c4598e feat: add C ABI, Python package, and CPU ISA paths
Expose the PP-OCRv6 engine through a stable C ABI and installable
shared and static libraries, plus a ctypes Python package that follows
the RapidOCR call shape. Keep AVX-512 out of the AVX2 object file and
speed up GEMM accumulate and the AArch64 GEMM tile.

Co-authored-by: Daniel <znsoft@163.com>
2026-10-04 23:40:06 +00:00

31 lines
746 B
Python

"""Same shape as ``python/demo.py`` on ``main``.
Pass model files or let the package download the PP-OCRv6 tiny bundle:
python demo.py --image page.png --model-type tiny
"""
from rapidocr import RapidOCR
engine = RapidOCR(
params={
"Det.model_type": "tiny",
"Rec.model_type": "tiny",
"Det.ocr_version": "PP-OCRv6",
"Rec.ocr_version": "PP-OCRv6",
"Global.use_cls": False,
}
)
if __name__ == "__main__":
import sys
image = sys.argv[1] if len(sys.argv) > 1 else None
if image is None:
raise SystemExit("usage: python demo.py image.jpg")
result = engine(image)
print(result.txts)
print(result.scores)
print(result.boxes)
print("elapse", result.elapse)