make sure the models will not be load twice (#422)

### What problem does this PR solve?

#381 
### Type of change

- [x] Refactoring
This commit is contained in:
KevinHuSh
2024-04-18 09:37:23 +08:00
committed by GitHub
parent e8570da856
commit 453c29170f
8 changed files with 26 additions and 12 deletions

View File

@ -41,7 +41,9 @@ class Recognizer(object):
"rag/res/deepdoc")
model_file_path = os.path.join(model_dir, task_name + ".onnx")
if not os.path.exists(model_file_path):
model_dir = snapshot_download(repo_id="InfiniFlow/deepdoc")
model_dir = snapshot_download(repo_id="InfiniFlow/deepdoc",
local_dir=os.path.join(get_project_base_directory(), "rag/res/deepdoc"),
local_dir_use_symlinks=False)
model_file_path = os.path.join(model_dir, task_name + ".onnx")
else:
model_file_path = os.path.join(model_dir, task_name + ".onnx")