update ieemoo-ai-isempty.py.

This commit is contained in:
Brainway
2022-10-11 06:36:36 +00:00
committed by Gitee
parent 6703c1bcaa
commit bd8f639537

View File

@ -124,16 +124,13 @@ def get_isempty():
result = {"success": "false",
"rst_cls": '-1',
}
try:
imgdata = base64.b64decode(pic)
imgdata_np = np.frombuffer(imgdata, dtype='uint8')
img_src = cv2.imdecode(imgdata_np, cv2.IMREAD_COLOR)
img_data = Image.fromarray(np.uint8(img_src))
result = predictor.normal_predict(img_data, result) # 1==empty, 0==nonEmpty
except Exception as e:
print(e)
return repr(result)
print(repr(result))
imgdata = base64.b64decode(pic)
imgdata_np = np.frombuffer(imgdata, dtype='uint8')
img_src = cv2.imdecode(imgdata_np, cv2.IMREAD_COLOR)
img_data = Image.fromarray(np.uint8(img_src))
result = predictor.normal_predict(img_data, result) # 1==empty, 0==nonEmpty
return repr(result)
if __name__ == "__main__":