Skip to content

πŸ“„ Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

fix: fixed issue #709

SWHL802c05647f70
diff --git a/python/rapidocr/__init__.py b/python/rapidocr/__init__.py
index 50ad245..cc622c6 100644
--- a/python/rapidocr/__init__.py
+++ b/python/rapidocr/__init__.py
@@ -1,11 +1,32 @@
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]
-from .main import RapidOCR
-from .utils.download_models import download_models
-from .utils.load_image import LoadImageError
from .utils.typings import EngineType, LangCls, LangDet, LangRec, ModelType, OCRVersion
-from .utils.vis_res import VisRes
+
+
+def __getattr__(name):
+ if name == "RapidOCR":
+ from .main import RapidOCR
+
+ return RapidOCR
+
+ if name == "LoadImageError":
+ from .utils.load_image import LoadImageError
+
+ return LoadImageError
+
+ if name == "VisRes":
+ from .utils.vis_res import VisRes
+
+ return VisRes
+
+ if name == "download_models":
+ from .utils.download_models import download_models
+
+ return download_models
+
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
+
__all__ = [
"RapidOCR",