fire1 bug
This commit is contained in:
parent
2e2abebd3b
commit
ddce16a893
|
@ -46,14 +46,14 @@ def fire1(ip: str, pic_url: str):
|
||||||
# 未配置灭火器事件
|
# 未配置灭火器事件
|
||||||
channel = grpc.insecure_channel(ip+':2001')
|
channel = grpc.insecure_channel(ip+':2001')
|
||||||
stub = BeiHangGrpc_pb2_grpc.Fire_RegStub(channel)
|
stub = BeiHangGrpc_pb2_grpc.Fire_RegStub(channel)
|
||||||
image_id = 3
|
image_id = 3
|
||||||
img_name = '{}.png'.format(uuid.uuid4())
|
img_name = '{}.png'.format(uuid.uuid4())
|
||||||
img_path = settings.BASE_DIR + '/temp/' + img_name
|
img_path = settings.BASE_DIR + '/temp/' + img_name
|
||||||
with open(img_path, "wb") as f:
|
with open(img_path, "wb") as f:
|
||||||
f.write(requests.get(url=pic_url, verify=False).content).read())
|
f.write(requests.get(url=pic_url, verify=False).content)
|
||||||
img = cv2.imread(img_path)
|
img = cv2.imread(img_path)
|
||||||
resized_img = cv2.resize(img, None, fx=0.25,fy=0.25)
|
resized_img = cv2.resize(img, None, fx=0.25, fy=0.25)
|
||||||
resized_img = cv2.imencode('.png',resized_img)[1]
|
resized_img = cv2.imencode('.png', resized_img)[1]
|
||||||
image_base64 = str(base64.b64encode(resized_img))[2:-1]
|
image_base64 = str(base64.b64encode(resized_img))[2:-1]
|
||||||
|
|
||||||
request = BeiHangGrpc_pb2.JinYu_Request(zzid=image_id, imgsbase64=image_base64)
|
request = BeiHangGrpc_pb2.JinYu_Request(zzid=image_id, imgsbase64=image_base64)
|
||||||
|
@ -65,10 +65,6 @@ def fire1(ip: str, pic_url: str):
|
||||||
return True, response
|
return True, response
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
path = 'http://10.99.5.24/evo-apigw/evo-oss/6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_7236037_7245601.jpg?token=399773e6-71f7-4202-b234-ff5aa8d2492c'
|
path = 'http://10.99.5.24/evo-apigw/evo-oss/6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_7236037_7245601.jpg?token=399773e6-71f7-4202-b234-ff5aa8d2492c'
|
||||||
base64img = str(base64.b64encode(BytesIO(requests.get(url=path, verify=False).content).read()), 'utf-8')
|
base64img = str(base64.b64encode(BytesIO(requests.get(url=path, verify=False).content).read()), 'utf-8')
|
||||||
|
@ -77,4 +73,4 @@ if __name__ == "__main__":
|
||||||
is_happend, res = analyse(
|
is_happend, res = analyse(
|
||||||
ip='122.224.229.24:2000',
|
ip='122.224.229.24:2000',
|
||||||
pic_url='http://10.99.5.24/evo-apigw/evo-oss/6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_7236037_7245601.jpg?token=399773e6-71f7-4202-b234-ff5aa8d2492c')
|
pic_url='http://10.99.5.24/evo-apigw/evo-oss/6ad010cf-ce45-11ec-9715-e4246c7d1635/20220826/1/dsf_3de82501-2521-11ed-884a-e4246c7d1635_7236037_7245601.jpg?token=399773e6-71f7-4202-b234-ff5aa8d2492c')
|
||||||
print(is_happend, res.helmetinfoList[0].head_helmet)
|
print(is_happend, res.helmetinfoList[0].head_helmet)
|
||||||
|
|
Loading…
Reference in New Issue