AiDB binding to Python Demo :
AiDB deployed as the server by fastapi.
- Ubuntu 20.04.4 LTS / MacOS
- Python 3.x
- Prepare environment
install python3.x、cmake、gcc and so on. All backend libs can download from AiDB
- Clone AiDB
git clone https://github.com/TalkUHulk/ai.deploy.box
- Compile AiDB library(custom backend)
cd ai.deploy.box
mkdir build && cd build
cmake -DC_API=ON -DENGINE_ORT=ON -DENGINE_MNN=ON -DENGINE_NCNN=ON -DENGINE_TNN=OFF -DENGINE_OPV=OFF -DENGINE_PPLite=OFF -DENGINE_NCNN_WASM=OFF -DBUILD_SAMPLE=OFF ../
make -j8
generate libAiDB_C.so in ai.deploy.box/build/source/ and put it in lib
- prepare files demo need.
download models and unzip it in aidb_python_demo then rename models
copy config in aidb_python_demo.
copy extra in aidb_python_demo.
folder structure
aidb_python_demo/
├── main.py
├── api
├── __init__.py
├── aidb.py
└── types.py
├── config
├── mnn_config.yaml
├── ncnn_config.yaml
.
.
.
└── onnx_config.yaml
├── models
├── onnx
├── ncnn
├── mnn
├── tnn
├── paddle
└── openvino
.
.
.
└── extra
├── ppocr_keys_v1.txt
.
.
└── imagenet-1k-id.txt
- Run
uvicorn main:app --reload
- Test
reference aidb_client.py