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