2024-06-09 04:29:29 +08:00
|
|
|
# Ultralytics YOLOv5 🚀, AGPL-3.0 license
|
2024-01-08 08:29:14 +08:00
|
|
|
"""Perform test request."""
|
2022-04-05 18:54:25 +08:00
|
|
|
|
2021-04-15 19:26:08 +08:00
|
|
|
import pprint
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
2024-01-08 08:29:14 +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
|
2024-01-08 08:29:14 +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
|
|
|
|
2024-01-08 08:29:14 +08:00
|
|
|
response = requests.post(DETECTION_URL, files={"image": image_data}).json()
|
2021-04-15 19:26:08 +08:00
|
|
|
|
|
|
|
pprint.pprint(response)
|