mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-10 21:10:55 +08:00
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>
31 lines
746 B
Python
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)
|