mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-13 14:31:00 +08:00
suport torch inference (#320)
* feat: add rapidocr_torch inference * ci: fix push workflow
This commit is contained in:
1 parent
86ae3f5079
commit
42e4d9d86c
47 files changed
+12296
No files matched your search
@@ -0,0 +1,77 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# @Author: SWHL
|
||||
# @Contact: liekkaskono@163.com
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import List, Union
|
||||
|
||||
import setuptools
|
||||
from get_pypi_latest_version import GetPyPiLatestVersion
|
||||
|
||||
|
||||
def read_txt(txt_path: Union[Path, str]) -> List[str]:
|
||||
with open(txt_path, "r", encoding="utf-8") as f:
|
||||
data = [v.rstrip("\n") for v in f]
|
||||
return data
|
||||
|
||||
|
||||
def get_readme():
|
||||
root_dir = Path(__file__).resolve().parent.parent
|
||||
readme_path = str(root_dir / "docs" / "doc_whl_rapidocr_ort.md")
|
||||
print(readme_path)
|
||||
with open(readme_path, "r", encoding="utf-8") as f:
|
||||
readme = f.read()
|
||||
return readme
|
||||
|
||||
|
||||
MODULE_NAME = "rapidocr_torch"
|
||||
|
||||
obtainer = GetPyPiLatestVersion()
|
||||
try:
|
||||
latest_version = obtainer(MODULE_NAME)
|
||||
except Exception:
|
||||
latest_version = "0.0.0"
|
||||
VERSION_NUM = obtainer.version_add_one(latest_version, add_patch=True)
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
match_str = " ".join(sys.argv[2:])
|
||||
matched_versions = obtainer.extract_version(match_str)
|
||||
if matched_versions:
|
||||
VERSION_NUM = matched_versions
|
||||
sys.argv = sys.argv[:2]
|
||||
|
||||
project_urls = {
|
||||
"Documentation": "https://rapidai.github.io/RapidOCRDocs",
|
||||
"Changelog": "https://github.com/RapidAI/RapidOCR/releases",
|
||||
}
|
||||
|
||||
setuptools.setup(
|
||||
name=MODULE_NAME,
|
||||
version=VERSION_NUM,
|
||||
platforms="Any",
|
||||
description="A cross platform OCR Library based on pytorch.",
|
||||
long_description=get_readme(),
|
||||
long_description_content_type="text/markdown",
|
||||
author="SWHL",
|
||||
author_email="liekkaskono@163.com",
|
||||
url="https://github.com/RapidAI/RapidOCR",
|
||||
project_urls=project_urls,
|
||||
license="Apache-2.0",
|
||||
include_package_data=True,
|
||||
install_requires=read_txt("requirements_torch.txt"),
|
||||
package_dir={"": MODULE_NAME},
|
||||
packages=setuptools.find_namespace_packages(where=MODULE_NAME),
|
||||
package_data={"": ["*.pth", "*.yaml", "*.txt"]},
|
||||
keywords=[
|
||||
"ocr,text_detection,text_recognition,db,onnxruntime,pytorch,paddleocr,openvino,rapidocr"
|
||||
],
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
],
|
||||
python_requires=">=3.10,<3.13",
|
||||
entry_points={
|
||||
"console_scripts": [f"{MODULE_NAME}={MODULE_NAME}.main:main"],
|
||||
},
|
||||
)
|
||||
Reference in new issue
Block a user