Skip to content

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

fix(python): fix incorrect usage of the exists function

SWHL2be4feff8242
diff --git a/python/rapidocr_onnxruntime/main.py b/python/rapidocr_onnxruntime/main.py
index e0b656b..4c0b0e1 100644
--- a/python/rapidocr_onnxruntime/main.py
+++ b/python/rapidocr_onnxruntime/main.py
@@ -31,7 +31,7 @@ logger = get_logger("RapidOCR")
class RapidOCR:
def __init__(self, config_path: Optional[str] = None, **kwargs):
- if config_path is not None and Path(config_path).exists:
+ if config_path is not None and Path(config_path).exists():
config = read_yaml(config_path)
else:
config = read_yaml(DEFAULT_CFG_PATH)
diff --git a/python/rapidocr_openvino/main.py b/python/rapidocr_openvino/main.py
index 0568036..4c0b0e1 100644
--- a/python/rapidocr_openvino/main.py
+++ b/python/rapidocr_openvino/main.py
@@ -31,11 +31,11 @@ logger = get_logger("RapidOCR")
class RapidOCR:
def __init__(self, config_path: Optional[str] = None, **kwargs):
- config = read_yaml(DEFAULT_CFG_PATH)
- config = update_model_path(config)
-
- if config_path is not None and Path(config_path).exists:
+ if config_path is not None and Path(config_path).exists():
config = read_yaml(config_path)
+ else:
+ config = read_yaml(DEFAULT_CFG_PATH)
+ config = update_model_path(config)
if kwargs:
updater = UpdateParameters()
diff --git a/python/rapidocr_paddle/main.py b/python/rapidocr_paddle/main.py
index 0568036..4c0b0e1 100644
--- a/python/rapidocr_paddle/main.py
+++ b/python/rapidocr_paddle/main.py
@@ -31,11 +31,11 @@ logger = get_logger("RapidOCR")
class RapidOCR:
def __init__(self, config_path: Optional[str] = None, **kwargs):
- config = read_yaml(DEFAULT_CFG_PATH)
- config = update_model_path(config)
-
- if config_path is not None and Path(config_path).exists:
+ if config_path is not None and Path(config_path).exists():
config = read_yaml(config_path)
+ else:
+ config = read_yaml(DEFAULT_CFG_PATH)
+ config = update_model_path(config)
if kwargs:
updater = UpdateParameters()