Files
FastDeploy/examples/vision/detection/paddledetection/python/serving/README_CN.md
T
Wang Xinyu 22d91a73c6 [Serving] Add a simple Python serving (#962)
* init simple serving

* simple serving is working

* ppyoloe demo

* Update README_CN.md

* update readme

* complete vision result to json
2022-12-26 21:09:08 +08:00

1.7 KiB

简体中文 | English

PaddleDetection Python轻量服务化部署示例

在部署前,需确认以下两个步骤

服务端:

# 下载部署示例代码
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy/examples/vision/detection/paddledetection/python/serving

# 下载PPYOLOE模型文件(如果不下载,代码里会自动从hub下载)
wget https://bj.bcebos.com/paddlehub/fastdeploy/ppyoloe_crn_l_300e_coco.tgz
tar xvf ppyoloe_crn_l_300e_coco.tgz

# 安装uvicorn
pip install uvicorn

# 启动服务,可选择是否使用GPU和TensorRT,可根据uvicorn --help配置IP、端口号等
# CPU
MODEL_DIR=ppyoloe_crn_l_300e_coco DEVICE=cpu uvicorn server:app
# GPU
MODEL_DIR=ppyoloe_crn_l_300e_coco DEVICE=gpu uvicorn server:app
# GPU上使用TensorRT (注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待)
MODEL_DIR=ppyoloe_crn_l_300e_coco DEVICE=gpu USE_TRT=true uvicorn server:app

客户端:

# 下载部署示例代码
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy/examples/vision/detection/paddledetection/python/serving

# 下载测试图片
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg

# 请求服务,获取推理结果(如有必要,请修改脚本中的IP和端口号)
python client.py