[Serving] Simple serving YOLOv5 and PP-OCRv3 example, add uvicorn to fastdeploy tools (#986)

* ppocrv3 simple serving

* add uvicorn to fd tools

* update ppdet simple serving readme

* yolov5 simple serving

* not import simple serving by default

* remove config from envs

* update comment
This commit is contained in:
Wang Xinyu
2022-12-28 10:03:42 +08:00
committed by GitHub
parent 0ead9d27c2
commit aea454a856
18 changed files with 364 additions and 42 deletions

View File

@@ -1,18 +1,16 @@
import fastdeploy as fd
from fastdeploy.serving.server import SimpleServer
import os
import logging
logging.getLogger().setLevel(logging.INFO)
# Get arguments from envrionment variables
model_dir = os.environ.get('MODEL_DIR')
device = os.environ.get('DEVICE', 'cpu')
use_trt = os.environ.get('USE_TRT', False)
# Prepare model, download from hub or use local dir
if model_dir is None:
model_dir = fd.download_model(name='ppyoloe_crn_l_300e_coco')
# Configurations
model_dir = 'ppyoloe_crn_l_300e_coco'
device = 'cpu'
use_trt = False
# Prepare model
model_file = os.path.join(model_dir, "model.pdmodel")
params_file = os.path.join(model_dir, "model.pdiparams")
config_file = os.path.join(model_dir, "infer_cfg.yml")
@@ -33,7 +31,7 @@ model_instance = fd.vision.detection.PPYOLOE(
runtime_option=option)
# Create server, setup REST API
app = fd.serving.SimpleServer()
app = SimpleServer()
app.register(
task_name="fd/ppyoloe",
model_handler=fd.serving.handler.VisionModelHandler,