mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-11 05:20:49 +08:00
fix: fixed issue #682
This commit is contained in:
4 files changed
+82
-12
No files matched your search
+21
-8
@@ -8,6 +8,7 @@ from typing import List, Union
|
||||
|
||||
import setuptools
|
||||
from get_pypi_latest_version import GetPyPiLatestVersion
|
||||
|
||||
from rapidocr.utils.download_models import download_models
|
||||
|
||||
|
||||
@@ -26,10 +27,19 @@ def get_readme():
|
||||
return readme
|
||||
|
||||
|
||||
def collect_package_files(package_root: Path, pattern: str) -> List[str]:
|
||||
return sorted(
|
||||
path.relative_to(package_root).as_posix()
|
||||
for path in package_root.rglob(pattern)
|
||||
if path.is_file()
|
||||
)
|
||||
|
||||
|
||||
download_models()
|
||||
|
||||
MODULE_NAME = "rapidocr"
|
||||
PACKAGE_DIR = Path(MODULE_NAME)
|
||||
PACKAGE_ROOT = PACKAGE_DIR
|
||||
WRAP_DIR = Path(f"wrap_temp/{MODULE_NAME}")
|
||||
NEED_WRAP = "bdist_wheel" in sys.argv
|
||||
|
||||
@@ -45,6 +55,16 @@ if NEED_WRAP:
|
||||
f.write("from .rapidocr.main import RapidOCR, VisRes\n")
|
||||
|
||||
PACKAGE_DIR = WRAP_DIR
|
||||
PACKAGE_ROOT = PACKAGE_DIR / MODULE_NAME
|
||||
|
||||
PACKAGE_DATA = collect_package_files(PACKAGE_ROOT, "*.yaml")
|
||||
PACKAGE_DATA.extend(
|
||||
[
|
||||
"models/ch_PP-OCRv4_det_mobile.onnx",
|
||||
"models/ch_PP-OCRv4_rec_mobile.onnx",
|
||||
"models/ch_ppocr_mobile_v2.0_cls_mobile.onnx",
|
||||
]
|
||||
)
|
||||
|
||||
obtainer = GetPyPiLatestVersion()
|
||||
try:
|
||||
@@ -81,14 +101,7 @@ setuptools.setup(
|
||||
install_requires=read_txt("requirements.txt"),
|
||||
package_dir={"": str(PACKAGE_DIR)},
|
||||
packages=setuptools.find_namespace_packages(where=str(PACKAGE_DIR)),
|
||||
package_data={
|
||||
MODULE_NAME: [
|
||||
"*.yaml",
|
||||
"models/ch_PP-OCRv4_det_mobile.onnx",
|
||||
"models/ch_PP-OCRv4_rec_mobile.onnx",
|
||||
"models/ch_ppocr_mobile_v2.0_cls_mobile.onnx",
|
||||
]
|
||||
},
|
||||
package_data={MODULE_NAME: PACKAGE_DATA},
|
||||
keywords=[
|
||||
"ocr,text_detection,text_recognition,db,onnxruntime,paddleocr,openvino,rapidocr"
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user