mmdeploy/tools/package_tools/test/test_sdk_python.sh
Chen Xin a14177c0eb
[Feature]: Add github prebuild workflow after new release. (#1852)
* add prebuild dockerfile

* add prebuild test workflw

* update

* update

* rm other workflow for test

* Update docker image

* add win1o prebuild

* add test prebuild

* add windows scripts in prebuilt package

* add linux scripts in prebuilt package

* generate_build_config.py

* fix cudnn search

* fix env

* fix script

* fix rpath

* fix cwd

* fix windows

* fix lint

* windows prebuild ci

* linux prebuild ci

* fix

* update trigger

* Revert "rm other workflow for test"

This reverts commit 0a0387275014efab71046d33a0e52904672b4012.

* update sdk build readme

* update prebuild

* fix dll deps for python >= 3.8 on windows

* fix ci

* test prebuild

* update test script to avoid modify upload folder

* add onnxruntime.dll to mmdeploy_python

* update prebuild workflow

* update prebuild

* Update loader.cpp.in

* remove exists prebuild files

* fix opencv env

* update cmake options for mmdeploy python build

* remove test code

* fix lint

---------

Co-authored-by: RunningLeon <mnsheng@yeah.net>
Co-authored-by: RunningLeon <maningsheng@sensetime.com>
2023-03-23 17:00:19 +08:00

35 lines
669 B
Bash
Executable File

set -e
WORKSPACE="."
MODEL_DIR="/__w/mmdeploy/testmodel/mmcls"
SDK_PYTHON_DIR="mmdeploy_python"
if [[ -n "$1" ]]; then
WORKSPACE=$1
fi
cd $WORKSPACE
cd $SDK_PYTHON_DIR
PY_VERSION=$(python3 -V | awk '{print $2}' | awk '{split($0, a, "."); print a[1]a[2]}')
test_pkg=$(ls | grep mmdeploy_python-*cp${PY_VERSION}*)
python3 -m pip install $test_pkg --force-reinstall
python3 -m pip install opencv-python
code="
import cv2
from mmdeploy_python import Classifier
import sys
handle = Classifier('$MODEL_DIR', 'cpu', 0)
img = cv2.imread('$MODEL_DIR/demo.jpg')
try:
res = handle(img)
print(res)
except:
print('error')
sys.exit(1)
"
python3 -c "$code"