mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-12 05:50:49 +08:00
feat(python): add model_root_dir and download_models (API + CLI)
This commit is contained in:
15 files changed
+372
-74
No files matched your search
@@ -2,6 +2,7 @@
|
||||
# @Author: SWHL
|
||||
# @Contact: liekkaskono@163.com
|
||||
import shlex
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -31,6 +32,17 @@ def test_cli(capsys, cmd, gt):
|
||||
assert gt in output
|
||||
|
||||
|
||||
@mark.parametrize("cmd", [f"download_models --config {tests_dir}/test_config.yaml"])
|
||||
def test_cli_download_models(capsys, cmd):
|
||||
main(shlex.split(cmd))
|
||||
output = capsys.readouterr().out.strip()
|
||||
assert "Models downloaded to" in output
|
||||
|
||||
model_dir = Path("./test_models").expanduser().resolve()
|
||||
assert model_dir.exists()
|
||||
shutil.rmtree(model_dir)
|
||||
|
||||
|
||||
@mark.parametrize("cmd", [f"config --save_cfg_file {tests_dir}/config.yaml"])
|
||||
def test_cli_config(capsys, cmd):
|
||||
main(shlex.split(cmd))
|
||||
|
||||
Reference in new issue
Block a user