Skip to content

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

refactor: standardize public interface with __all__

SWHL5aa9079e753c
diff --git a/python/rapidocr/__init__.py b/python/rapidocr/__init__.py
index 15e216c..1b47892 100644
--- a/python/rapidocr/__init__.py
+++ b/python/rapidocr/__init__.py
@@ -5,3 +5,15 @@ from .main import RapidOCR
from .utils.load_image import LoadImageError
from .utils.typings import EngineType, LangCls, LangDet, LangRec, ModelType, OCRVersion
from .utils.vis_res import VisRes
+
+__all__ = [
+ "RapidOCR",
+ "LoadImageError",
+ "EngineType",
+ "LangCls",
+ "LangDet",
+ "LangRec",
+ "ModelType",
+ "OCRVersion",
+ "VisRes",
+]
diff --git a/python/rapidocr/cal_rec_boxes/__init__.py b/python/rapidocr/cal_rec_boxes/__init__.py
index 5127715..7f7e03e 100644
--- a/python/rapidocr/cal_rec_boxes/__init__.py
+++ b/python/rapidocr/cal_rec_boxes/__init__.py
@@ -2,3 +2,5 @@
# @Author: SWHL
# @Contact: [email protected]
from .main import CalRecBoxes
+
+__all__ = ["CalRecBoxes"]
diff --git a/python/rapidocr/ch_ppocr_cls/__init__.py b/python/rapidocr/ch_ppocr_cls/__init__.py
index 7110450..5940498 100644
--- a/python/rapidocr/ch_ppocr_cls/__init__.py
+++ b/python/rapidocr/ch_ppocr_cls/__init__.py
@@ -3,3 +3,5 @@
# @Contact: [email protected]
from .main import TextClassifier
from .utils import TextClsOutput
+
+__all__ = ["TextClassifier", "TextClsOutput"]
diff --git a/python/rapidocr/ch_ppocr_det/__init__.py b/python/rapidocr/ch_ppocr_det/__init__.py
index 7fa4067..f799465 100644
--- a/python/rapidocr/ch_ppocr_det/__init__.py
+++ b/python/rapidocr/ch_ppocr_det/__init__.py
@@ -3,3 +3,5 @@
# @Contact: [email protected]
from .main import TextDetector
from .utils import TextDetOutput
+
+__all__ = ["TextDetector", "TextDetOutput"]
diff --git a/python/rapidocr/ch_ppocr_rec/__init__.py b/python/rapidocr/ch_ppocr_rec/__init__.py
index c1f1347..1912993 100644
--- a/python/rapidocr/ch_ppocr_rec/__init__.py
+++ b/python/rapidocr/ch_ppocr_rec/__init__.py
@@ -3,3 +3,5 @@
# @Contact: [email protected]
from .main import TextRecognizer
from .typings import TextRecInput, TextRecOutput
+
+__all__ = ["TextRecognizer", "TextRecInput", "TextRecOutput"]
diff --git a/python/rapidocr/inference_engine/mnn/__init__.py b/python/rapidocr/inference_engine/mnn/__init__.py
index 8185667..dcc515c 100644
--- a/python/rapidocr/inference_engine/mnn/__init__.py
+++ b/python/rapidocr/inference_engine/mnn/__init__.py
@@ -2,3 +2,5 @@
# @Author: SWHL
# @Contact: [email protected]
from .main import MNNError, MNNInferSession
+
+__all__ = ["MNNError", "MNNInferSession"]
diff --git a/python/rapidocr/inference_engine/onnxruntime/__init__.py b/python/rapidocr/inference_engine/onnxruntime/__init__.py
index fe32edf..38d8d1c 100644
--- a/python/rapidocr/inference_engine/onnxruntime/__init__.py
+++ b/python/rapidocr/inference_engine/onnxruntime/__init__.py
@@ -1,4 +1,6 @@
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]
-from .main import OrtInferSession
+from .main import ONNXRuntimeError, OrtInferSession
+
+__all__ = ["ONNXRuntimeError", "OrtInferSession"]
diff --git a/python/rapidocr/inference_engine/openvino/__init__.py b/python/rapidocr/inference_engine/openvino/__init__.py
index 131c642..b10996d 100644
--- a/python/rapidocr/inference_engine/openvino/__init__.py
+++ b/python/rapidocr/inference_engine/openvino/__init__.py
@@ -2,3 +2,5 @@
# @Author: SWHL
# @Contact: [email protected]
from .main import OpenVINOError, OpenVINOInferSession
+
+__all__ = ["OpenVINOError", "OpenVINOInferSession"]
diff --git a/python/rapidocr/inference_engine/paddle/__init__.py b/python/rapidocr/inference_engine/paddle/__init__.py
index a3a0185..ad51957 100644
--- a/python/rapidocr/inference_engine/paddle/__init__.py
+++ b/python/rapidocr/inference_engine/paddle/__init__.py
@@ -2,3 +2,5 @@
# @Author: SWHL
# @Contact: [email protected]
from .main import PaddleInferError, PaddleInferSession
+
+__all__ = ["PaddleInferError", "PaddleInferSession"]
diff --git a/python/rapidocr/inference_engine/pytorch/__init__.py b/python/rapidocr/inference_engine/pytorch/__init__.py
index 33ac8b0..b747d01 100644
--- a/python/rapidocr/inference_engine/pytorch/__init__.py
+++ b/python/rapidocr/inference_engine/pytorch/__init__.py
@@ -2,3 +2,5 @@
# @Author: SWHL
# @Contact: [email protected]
from .main import TorchInferError, TorchInferSession
+
+__all__ = ["TorchInferError", "TorchInferSession"]
diff --git a/python/rapidocr/inference_engine/tensorrt/__init__.py b/python/rapidocr/inference_engine/tensorrt/__init__.py
index 54b9166..948b1ea 100644
--- a/python/rapidocr/inference_engine/tensorrt/__init__.py
+++ b/python/rapidocr/inference_engine/tensorrt/__init__.py
@@ -1,4 +1,6 @@
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]
-from .main import TRTInferSession
+from .main import TensorRTError, TRTInferSession
+
+__all__ = ["TensorRTError", "TRTInferSession"]