mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 00:57:33 +08:00
[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:
@@ -1,20 +1,15 @@
|
||||
import requests
|
||||
import json
|
||||
import cv2
|
||||
import base64
|
||||
import fastdeploy as fd
|
||||
from fastdeploy.serving.utils import cv2_to_base64
|
||||
|
||||
if __name__ == '__main__':
|
||||
url = "http://127.0.0.1:8000/fd/ppyoloe"
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
im = cv2.imread("000000014439.jpg")
|
||||
data = {
|
||||
"data": {
|
||||
"image": fd.serving.utils.cv2_to_base64(im)
|
||||
},
|
||||
"parameters": {}
|
||||
}
|
||||
data = {"data": {"image": cv2_to_base64(im)}, "parameters": {}}
|
||||
|
||||
resp = requests.post(url=url, headers=headers, data=json.dumps(data))
|
||||
if resp.status_code == 200:
|
||||
|
Reference in New Issue
Block a user