-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
21 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ on: | |
tags: | ||
- v* | ||
|
||
|
||
env: | ||
RESOURCES_URL: https://github.com/RapidAI/RapidStructure/releases/download/v0.0.0/rapid_orientation_models.zip | ||
|
||
|
@@ -31,6 +30,7 @@ jobs: | |
rm rapid_orientation/models/.gitkeep | ||
mv $DIR_NAME/*.onnx rapid_orientation/models/ | ||
pip install -r requirements.txt | ||
pip install pytest | ||
pytest tests/test_orientation.py | ||
GenerateWHL_PushPyPi: | ||
|
@@ -49,12 +49,14 @@ jobs: | |
- name: Run setup | ||
run: | | ||
pip install -r requirements.txt | ||
python -m pip install --upgrade pip | ||
pip install wheel get_pypi_latest_version | ||
wget $RESOURCES_URL | ||
ZIP_NAME=${RESOURCES_URL##*/} | ||
DIR_NAME=${ZIP_NAME%.*} | ||
unzip $ZIP_NAME | ||
mv $DIR_NAME/*.onnx rapid_orientation/models/ | ||
python setup_orientation.py bdist_wheel ${{ github.ref_name }} | ||
python setup.py bdist_wheel ${{ github.ref_name }} | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1 @@ | ||
## rapid-orientation | ||
<p align="left"> | ||
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a> | ||
<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a> | ||
<a href="https://pypi.org/project/rapid-orientation/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapid-orientation"></a> | ||
<a href="https://pepy.tech/project/rapid-orientation"><img src="https://static.pepy.tech/personalized-badge/rapid-orientation?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a> | ||
</p> | ||
|
||
|
||
### 1. Install package by pypi. | ||
```bash | ||
$ pip install rapid-orientation | ||
``` | ||
|
||
### 2. Run by script. | ||
- RapidOrientation has the default `model_path` value, you can set the different value of `model_path` to use different models, e.g. `orientation_engine = RapidOrientation(model_path='rapid_orientation.onnx')` | ||
- See details, for [README_Layout](https://github.com/RapidAI/RapidStructure/blob/main/docs/README_Orientation.md) . | ||
- 📌 `layout.png` source: [link](https://github.com/RapidAI/RapidStructure/blob/main/test_images/layout.png) | ||
|
||
```python | ||
from rapid_orientation import RapidOrientation | ||
|
||
orientation_engine = RapidOrientation() | ||
|
||
with open('test_images/layout.png', 'rb') as f: | ||
img = f.read() | ||
orientation_res, elapse = orientation_engine(img) | ||
print(orientation_res) | ||
``` | ||
|
||
### 3. Run by command line. | ||
- Usage: | ||
```bash | ||
$ rapid_orientation -h | ||
usage: rapid_orientation [-h] -img IMG_PATH [-m MODEL_PATH] | ||
|
||
optional arguments: | ||
-h, --help show this help message and exit | ||
-img IMG_PATH, --img_path IMG_PATH | ||
Path to image for layout. | ||
-m MODEL_PATH, --model_path MODEL_PATH | ||
The model path used for inference | ||
``` | ||
- Example: | ||
```bash | ||
$ rapid_orientation -img layout.png | ||
``` | ||
|
||
### 4. Result. | ||
```python | ||
# Return str, four types::0 | 90 | 180 | 270 | ||
``` | ||
See [documentation](https://github.com/RapidAI/RapidOrientation) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
numpy>=1.21.6,<2.0.0 | ||
opencv_python>=4.6.0.66 | ||
setuptools>=61.2.0 | ||
PyYAML | ||
pytest==8.1.1 | ||
pip>=24.0 | ||
onnxruntime | ||
wheel | ||
get_pypi_latest_version | ||
Pillow | ||
tqdm | ||
requests | ||
Pillow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,21 @@ | |
# @Contact: [email protected] | ||
import sys | ||
from pathlib import Path | ||
from typing import List | ||
|
||
import setuptools | ||
from get_pypi_latest_version import GetPyPiLatestVersion | ||
|
||
|
||
def read_txt(txt_path: str) -> List: | ||
if not isinstance(txt_path, str): | ||
txt_path = str(txt_path) | ||
|
||
with open(txt_path, "r", encoding="utf-8") as f: | ||
data = list(map(lambda x: x.rstrip("\n"), f)) | ||
return data | ||
|
||
|
||
def get_readme(): | ||
root_dir = Path(__file__).resolve().parent | ||
readme_path = str(root_dir / "docs" / "doc_whl_rapid_orientation.md") | ||
|
@@ -32,22 +42,14 @@ def get_readme(): | |
name=MODULE_NAME, | ||
version=VERSION_NUM, | ||
platforms="Any", | ||
long_description=get_readme(), | ||
long_description_content_type="text/markdown", | ||
description="Tools for classifying the direction of images containing text based ONNXRuntime.", | ||
author="SWHL", | ||
author_email="[email protected]", | ||
url="https://github.com/RapidAI/RapidStructure", | ||
url="https://github.com/RapidAI/RapidOrientation", | ||
license="Apache-2.0", | ||
include_package_data=True, | ||
install_requires=[ | ||
"onnxruntime>=1.7.0", | ||
"PyYAML>=6.0", | ||
"opencv_python>=4.5.1.48", | ||
"numpy>=1.21.6", | ||
"Pillow", | ||
], | ||
packages=[MODULE_NAME, f"{MODULE_NAME}.models"], | ||
install_requires=read_txt("requirements.txt"), | ||
packages=[MODULE_NAME, f"{MODULE_NAME}.models", f"{MODULE_NAME}.utils"], | ||
package_data={"": ["*.onnx", "*.yaml"]}, | ||
keywords=["ppstructure,layout,rapidocr,rapid_orientation"], | ||
classifiers=[ | ||
|
@@ -58,8 +60,6 @@ def get_readme(): | |
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
], | ||
python_requires=">=3.6,<3.12", | ||
entry_points={ | ||
"console_scripts": [f"{MODULE_NAME}={MODULE_NAME}.{MODULE_NAME}:main"] | ||
}, | ||
python_requires=">=3.6,<3.13", | ||
entry_points={"console_scripts": [f"{MODULE_NAME}={MODULE_NAME}.main:main"]}, | ||
) |