example_request.py 368 B

12345678910111213141516171819
  1. # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
  2. """
  3. Perform test request
  4. """
  5. import pprint
  6. import requests
  7. DETECTION_URL = "http://localhost:5000/v1/object-detection/yolov5s"
  8. IMAGE = "zidane.jpg"
  9. # Read image
  10. with open(IMAGE, "rb") as f:
  11. image_data = f.read()
  12. response = requests.post(DETECTION_URL, files={"image": image_data}).json()
  13. pprint.pprint(response)