2023-04-14 20:36:16 +08:00
|
|
|
# YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
|
2022-04-05 18:54:25 +08:00
|
|
|
"""
|
|
|
|
Perform test request
|
|
|
|
"""
|
|
|
|
|
2021-04-15 19:26:08 +08:00
|
|
|
import pprint
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
2023-02-18 08:06:24 +08:00
|
|
|
DETECTION_URL = 'http://localhost:5000/v1/object-detection/yolov5s'
|
|
|
|
IMAGE = 'zidane.jpg'
|
2021-04-15 19:26:08 +08:00
|
|
|
|
2022-04-05 18:54:25 +08:00
|
|
|
# Read image
|
2023-02-18 08:06:24 +08:00
|
|
|
with open(IMAGE, 'rb') as f:
|
2022-04-05 18:54:25 +08:00
|
|
|
image_data = f.read()
|
2021-04-15 19:26:08 +08:00
|
|
|
|
2023-02-18 08:06:24 +08:00
|
|
|
response = requests.post(DETECTION_URL, files={'image': image_data}).json()
|
2021-04-15 19:26:08 +08:00
|
|
|
|
|
|
|
pprint.pprint(response)
|