Skip to content

Commit 2f39268

Browse files
committed
chore: init commit
0 parents  commit 2f39268

File tree

17 files changed

+1246
-0
lines changed

17 files changed

+1246
-0
lines changed

.github/workflows/SyncToGitee.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: SyncToGitee
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
repo-sync:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout source codes
11+
uses: actions/checkout@v4
12+
13+
- name: Mirror the Github organization repos to Gitee.
14+
uses: Yikun/hub-mirror-action@v1.4
15+
with:
16+
src: 'github/RapidAI'
17+
dst: 'gitee/RapidAI'
18+
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
19+
dst_token: ${{ secrets.GITEE_TOKEN }}
20+
force_update: true
21+
# only sync this repo
22+
static_list: "RapidOCR"
23+
debug: true
24+
25+
- name: Mirror the Github organization repos to Gitee.
26+
uses: Yikun/hub-mirror-action@v1.4
27+
with:
28+
src: 'github/RapidAI'
29+
dst: 'gitee/openKylin'
30+
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
31+
dst_token: ${{ secrets.GITEE_TOKEN }}
32+
force_update: true
33+
# only sync this repo
34+
static_list: "RapidOCR"
35+
debug: true
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Push rapidocr_web to pypi
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
GenerateWHL_PushPyPi:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python 3.10
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.10'
19+
architecture: 'x64'
20+
21+
- name: Run setup.py
22+
run: |
23+
cd ocrweb
24+
pip install -r requirements.txt
25+
26+
python -m pip install --upgrade pip
27+
python setup.py bdist_wheel "${{ github.ref_name }}"
28+
29+
- name: Publish distribution 📦 to PyPI
30+
uses: pypa/gh-action-pypi-publish@v1.5.0
31+
with:
32+
password: ${{ secrets.RAPIDOCR_OPENVINO }}
33+
packages_dir: ocrweb/dist/
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: Package ocrweb
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
9+
env:
10+
package_name: RapidOCRWeb
11+
rapidocr_web_dir: ocrweb/rapidocr_web/
12+
13+
jobs:
14+
create_release:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
upload_url: ${{ steps.create_release.outputs.upload_url }}
18+
steps:
19+
- name: get_cur_time
20+
uses: srfrnk/current-time@master
21+
id: get_cur_time
22+
with:
23+
format: YYYY-MM-DD-HH-mm-ss
24+
- name: create_release
25+
id: create_release
26+
uses: marvinpinto/action-automatic-releases@latest
27+
with:
28+
repo_token: ${{ secrets.GITHUB_TOKEN }}
29+
automatic_release_tag: Draft-${{ steps.get_cur_time.outputs.formattedTime }}
30+
prerelease: false
31+
draft: true
32+
33+
build_windows:
34+
name: build_windows
35+
runs-on: ${{ matrix.os }}
36+
needs: create_release
37+
strategy:
38+
matrix:
39+
os: ['windows-2022', 'windows-2019']
40+
41+
steps:
42+
- name: Pull latest code
43+
uses: actions/checkout@v4
44+
45+
- name: Set up Python 3.10
46+
uses: actions/setup-python@v4
47+
with:
48+
python-version: '3.10'
49+
architecture: 'x64'
50+
51+
- name: Display Python version
52+
run: python -c "import sys; print(sys.version)"
53+
54+
- name: Install environments
55+
run: |
56+
pip3 install Pillow pyinstaller Flask>=2.1.0 rapidocr_onnxruntime>=1.2.8 get_pypi_latest_version
57+
58+
- name: Run pyinstaller
59+
id: run_pyinstaller
60+
shell: bash
61+
run: |
62+
cd ${{ env.rapidocr_web_dir }}
63+
pyinstaller ocrweb.spec
64+
cp -r static templates dist/${{ env.package_name }}
65+
rm dist/${{ env.package_name }}/cv2/opencv_videoio_ffmpe*.dll || echo "未找到opencv_videoio_ffmpeg"
66+
echo "VERSION=$(get_pypi_latest_version rapid_videocr)" >> $GITHUB_OUTPUT
67+
68+
- name: Concat file path
69+
id: concat_file_path
70+
shell: bash
71+
env:
72+
ZIP_WIN_NAME: ${{ env.package_name }}-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer.zip
73+
Win_DIST_DIR: ${{ github.workspace }}\ocrweb\rapidocr_web\dist
74+
run: |
75+
echo "ZIP_NAME=$ZIP_WIN_NAME" >> $GITHUB_OUTPUT
76+
echo "Win_PACKAGE_DIR=$Win_DIST_DIR\${{ env.package_name }}" >> $GITHUB_OUTPUT
77+
echo "Win_ZIP_FULL_PATH=$Win_DIST_DIR\\$ZIP_WIN_NAME" >> $GITHUB_OUTPUT
78+
79+
- name: Zip package
80+
run: |
81+
powershell Compress-Archive ${{ steps.concat_file_path.outputs.Win_PACKAGE_DIR }} ${{ steps.concat_file_path.outputs.Win_ZIP_FULL_PATH }}
82+
83+
- name: Upload release asset
84+
id: upload-release-asset-windows
85+
uses: actions/upload-release-asset@v1
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
with:
89+
upload_url: ${{ needs.create_release.outputs.upload_url }}
90+
asset_path: ${{ steps.concat_file_path.outputs.Win_ZIP_FULL_PATH }}
91+
asset_name: ${{ steps.concat_file_path.outputs.ZIP_NAME }}
92+
asset_content_type: application/zip
93+
94+
build_linux:
95+
name: build_linux
96+
runs-on: ${{ matrix.os }}
97+
needs: create_release
98+
strategy:
99+
matrix:
100+
os: ['ubuntu-20.04', 'ubuntu-22.04', 'macos-13', 'macos-12', 'macos-11']
101+
102+
steps:
103+
- name: Pull latest code
104+
uses: actions/checkout@v4
105+
106+
- name: Set up Python 3.10
107+
uses: actions/setup-python@v4
108+
with:
109+
python-version: '3.10'
110+
architecture: 'x64'
111+
112+
- name: Display Python version
113+
run: python -c "import sys; print(sys.version)"
114+
115+
- name: Install environments
116+
run: |
117+
pip3 install Pillow pyinstaller Flask>=2.1.0 rapidocr_onnxruntime>=1.2.8 get_pypi_latest_version
118+
119+
- name: Run pyinstaller
120+
id: run_pyinstaller
121+
shell: bash
122+
run: |
123+
cd ocrweb/rapidocr_web/
124+
pyinstaller ocrweb.spec
125+
cp -r static templates dist/${{ env.package_name }}
126+
rm dist/${{ env.package_name }}/cv2/opencv_videoio_ffmpe*.dll || echo "未找到opencv_videoio_ffmpeg"
127+
echo "VERSION=$(get_pypi_latest_version rapid_videocr)" >> $GITHUB_OUTPUT
128+
129+
- name: Concat file path
130+
id: concat_file_path
131+
env:
132+
ZIP_NAME: ${{ env.package_name }}-${{ steps.run_pyinstaller.outputs.VERSION }}-${{ matrix.os }}-${{ runner.arch }}-no-installer.zip
133+
Linux_DIST_DIR: ${{ github.workspace }}/ocrweb/rapidocr_web/dist
134+
run: |
135+
echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_OUTPUT
136+
echo "Linux_PACKAGE_DIR=$Linux_DIST_DIR/${{ env.package_name }}" >> $GITHUB_OUTPUT
137+
echo "Linux_ZIP_FULL_PATH=$Linux_DIST_DIR/$ZIP_NAME" >> $GITHUB_OUTPUT
138+
echo "Linux_DIST_DIR=$Linux_DIST_DIR" >> $GITHUB_OUTPUT
139+
140+
- name: Zip package
141+
run: |
142+
cd ${{ steps.concat_file_path.outputs.Linux_DIST_DIR }}
143+
zip -r ${{ steps.concat_file_path.outputs.ZIP_NAME }} ${{ env.package_name }}
144+
145+
- name: Upload release asset
146+
id: upload-release-asset-linux-macOS
147+
uses: actions/upload-release-asset@v1
148+
env:
149+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
150+
with:
151+
upload_url: ${{ needs.create_release.outputs.upload_url }}
152+
asset_path: ${{ steps.concat_file_path.outputs.Linux_ZIP_FULL_PATH }}
153+
asset_name: ${{ steps.concat_file_path.outputs.ZIP_NAME }}
154+
asset_content_type: application/zip

.gitignore

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Python template
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
.pytest_cache
8+
9+
# C extensions
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
pip-wheel-metadata/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
# *.manifest
37+
# *.spec
38+
*.res
39+
40+
# Installer logs
41+
pip-log.txt
42+
pip-delete-this-directory.txt
43+
44+
# Unit test / coverage reports
45+
htmlcov/
46+
.tox/
47+
.nox/
48+
.coverage
49+
.coverage.*
50+
.cache
51+
nosetests.xml
52+
coverage.xml
53+
*.cover
54+
*.py,cover
55+
.hypothesis/
56+
.pytest_cache/
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
local_settings.py
65+
db.sqlite3
66+
db.sqlite3-journal
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
target/
80+
81+
# Jupyter Notebook
82+
.ipynb_checkpoints
83+
84+
# IPython
85+
profile_default/
86+
ipython_config.py
87+
88+
# pyenv
89+
.python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
99+
__pypackages__/
100+
101+
# Celery stuff
102+
celerybeat-schedule
103+
celerybeat.pid
104+
105+
# SageMath parsed files
106+
*.sage.py
107+
108+
# Environments
109+
.env
110+
.venv
111+
env/
112+
venv/
113+
ENV/
114+
env.bak/
115+
venv.bak/
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# Rope project settings
122+
.ropeproject
123+
124+
# mkdocs documentation
125+
/site
126+
127+
# mypy
128+
.mypy_cache/
129+
.dmypy.json
130+
dmypy.json
131+
132+
# Pyre type checker
133+
.pyre/
134+
135+
#idea
136+
.vs
137+
.vscode
138+
.idea
139+
/images
140+
/models
141+
142+
#models
143+
*.onnx
144+
145+
*.ttf
146+
*.ttc
147+
148+
long1.jpg
149+
150+
*.bin
151+
*.mapping
152+
*.xml
153+
154+
*.pdiparams
155+
*.pdiparams.info
156+
*.pdmodel
157+
158+
.DS_Store
159+
*.npy

0 commit comments

Comments
 (0)