mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-11 21:40:52 +08:00
fix(rapidocr): fixed path error of infernce engine when customizing incoming parameters
This commit is contained in:
1 parent
a8ea87c4cf
commit
a87ecab2d3
5 files changed
+5
-7
No files matched your search
@@ -121,8 +121,6 @@ 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
|
||||
|
||||
@@ -32,7 +32,7 @@ class OrtInferSession(InferSession):
|
||||
def __init__(self, config: Dict[str, Any]):
|
||||
self.logger = Logger(logger_name=__name__).get_log()
|
||||
|
||||
model_path = config.get("model_path", None)
|
||||
model_path = Path(config.get("model_path", None))
|
||||
if model_path is None:
|
||||
# 说明用户没有指定自己模型,使用默认模型
|
||||
model_info = self.get_model_url(
|
||||
|
||||
@@ -21,7 +21,7 @@ class OpenVINOInferSession(InferSession):
|
||||
|
||||
core = Core()
|
||||
|
||||
model_path = config.get("model_path", None)
|
||||
model_path = Path(config.get("model_path", None))
|
||||
if model_path is None:
|
||||
model_info = self.get_model_url(
|
||||
config.engine_name, config.task_type, config.lang
|
||||
|
||||
@@ -24,7 +24,7 @@ class PaddleInferSession(InferSession):
|
||||
self.logger = Logger(logger_name=__name__).get_log()
|
||||
self.mode = mode
|
||||
|
||||
model_dir = config.get("model_dir", None)
|
||||
model_dir = Path(config.get("model_dir", None))
|
||||
if model_dir is None:
|
||||
model_info = self.get_model_url(
|
||||
config.engine_name, config.task_type, config.lang
|
||||
|
||||
@@ -20,7 +20,7 @@ class TorchInferSession(InferSession):
|
||||
def __init__(self, config) -> None:
|
||||
self.logger = Logger(logger_name=__name__).get_log()
|
||||
|
||||
model_path = config.get("model_path", None)
|
||||
model_path = Path(config.get("model_path", None))
|
||||
if model_path is None:
|
||||
model_info = self.get_model_url(
|
||||
config.engine_name, config.task_type, config.lang
|
||||
@@ -36,7 +36,7 @@ class TorchInferSession(InferSession):
|
||||
)
|
||||
)
|
||||
|
||||
model_path = self._verify_model(model_path)
|
||||
self._verify_model(model_path)
|
||||
|
||||
all_arch_config = OmegaConf.load(DEFAULT_CFG_PATH)
|
||||
file_name = model_path.stem
|
||||
|
||||
Reference in new issue
Block a user