Skip to content

πŸ“„ Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

Add actions of pushing whl to pypi

SWHL917c3e6a843c
diff --git a/.github/workflows/gen_whl_to_pypi.yml b/.github/workflows/gen_whl_to_pypi.yml
new file mode 100644
index 0000000..90e947d
--- /dev/null
+++ b/.github/workflows/gen_whl_to_pypi.yml
@@ -0,0 +1,40 @@
+name: Package whl files to push to pypi
+
+on:
+ push:
+ branches: [ main ]
+ paths:
+ - 'python/rapidocr_onnxruntime/**'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set SSH Environment
+ env:
+ DEPLOY_KEYS: ${{ secrets.GEN_PYTHON_SDK }}
+ run: |
+ mkdir -p ~/.ssh/
+ echo "$DEPLOY_KEYS" > ~/.ssh/id_rsa
+ chmod 600 ~/.ssh/id_rsa
+ chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
+
+ - name: Run setup.py
+ run: |
+ cd python
+ mkdir rapidocr_onnxruntime_t
+ mv rapidocr_onnxruntime rapidocr_onnxruntime_t
+ mv rapidocr_onnxruntime_t rapidocr_onnxruntime
+ cd rapidocr_onnxruntime
+ echo "from .rapidocr_onnxruntime.rapid_ocr_api import TextSystem" > __init__.py
+
+ cd ..
+
+ python setup.py bdist_wheel
+
+ - name: Push to pypi
+ run: |
+ python -m twine upload dist/* -u ${{ secrets.TWINE_NAME }} -p ${{ secrets.TWINE_PWD }}
diff --git a/python/setup.py b/python/setup.py
new file mode 100644
index 0000000..72dfb00
--- /dev/null
+++ b/python/setup.py
@@ -0,0 +1,30 @@
+# -*- encoding: utf-8 -*-
+# @Author: SWHL
+# @Contact: [email protected]
+import setuptools
+
+
+with open('README.md', 'r') as f:
+ README = f.read()
+
+module_name = 'rapidocr_onnxruntime'
+
+setuptools.setup(
+ name=module_name,
+ version="1.0.0",
+ platforms="Windows & Linux & Mac",
+ description="RapidOCR",
+ long_description=README,
+ long_description_content_type='text/markdown',
+ author="SWHL",
+ author_email="[email protected]",
+ url="https://github.com/RapidAI/RapidOCR",
+ license='Apache-2.0',
+ include_package_data=True,
+ install_requires=["pyclipper>=1.2.1", "onnxruntime",
+ "opencv_python>=4.5.1.48", "numpy>=1.19.3",
+ "six>=1.15.0", "Shapely>=1.7.1"],
+ package_dir={'': module_name},
+ packages=setuptools.find_packages(where=module_name)
+)
+