# -*- coding: utf-8 -*- # @Time : 2022/3/2 9:25 # @Author : MaochengHu # @Email : wojiaohumaocheng@gmail.com # @File : yolo_test_docker.py # @Project : server_develop import os from server_utils.image_convert import path2base64 from server_utils.read_properties import get_properties_dict import requests headers = {"Content-Type": "application/json"} properties_dict = get_properties_dict() inference_address = properties_dict.get("inference_address") def single_test(input_source): request_url = "{}/predictions/yolov5".format(inference_address) image_base64 = path2base64(input_source) payload = {"data": image_base64, "output_methods": str(["pd_xywh_json"]), "base64_bool": True} print(request_url) req = requests.post(url=request_url, data=payload) print(eval(req.text)) def main(): input_source = os.path.join(os.getcwd(), "../test_images/test1.jpg") single_test(input_source) if __name__ == "__main__": main()