增加异常处理

This commit is contained in:
2024-06-25 16:32:43 +08:00
parent e00c33b5af
commit 015cd03590

View File

@@ -98,9 +98,13 @@ def merge_result(result1, result2):
# 获取图片旋转角度
def get_image_rotation_angle(img):
angle = 0
model = paddleclas.PaddleClas(model_name="text_image_orientation")
result = model.predict(input_data=img)
angle = int(next(result)[0]["label_names"][0])
try:
angle = int(next(result)[0]["label_names"][0])
except Exception as e:
logging.error("获取图片旋转角度失败", e)
return angle