client_minimal.py 496 B

1234567891011121314151617
  1. ''' Example client sending POST request to server and printing the YOLO results
  2. '''
  3. import requests as r
  4. import json
  5. from pprint import pprint
  6. def send_request(image = '../images/zidane.jpg', model_name = 'yolov5s'):
  7. res = r.post("http://localhost:8000",
  8. data={'model_name': model_name},
  9. files = {'file': open(image , "rb")} #pass the files here
  10. )
  11. pprint(json.loads(res.text))
  12. if __name__ == '__main__':
  13. send_request()