Skip to content

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

fix(rapidocr): fixed issue #405 (#406)

Elwina8ea87c4cffb
diff --git a/python/rapidocr/inference_engine/base.py b/python/rapidocr/inference_engine/base.py
index 8e161a7..bb14919 100644
--- a/python/rapidocr/inference_engine/base.py
+++ b/python/rapidocr/inference_engine/base.py
@@ -121,6 +121,8 @@ class InferSession(abc.ABC):
if not model_path.is_file():
raise FileExistsError(f"{model_path} is not a file.")
+ return model_path
+
@abc.abstractmethod
def have_key(self, key: str = "character") -> bool:
pass
diff --git a/python/rapidocr/inference_engine/torch.py b/python/rapidocr/inference_engine/torch.py
index 651862a..2e69293 100644
--- a/python/rapidocr/inference_engine/torch.py
+++ b/python/rapidocr/inference_engine/torch.py
@@ -36,7 +36,7 @@ class TorchInferSession(InferSession):
)
)
- self._verify_model(model_path)
+ model_path = self._verify_model(model_path)
all_arch_config = OmegaConf.load(DEFAULT_CFG_PATH)
file_name = model_path.stem