修正docker镜像构建

This commit is contained in:
2024-09-25 16:07:12 +08:00
parent 3189caf7aa
commit 72794f699e
13 changed files with 44 additions and 46 deletions

View File

@@ -0,0 +1,26 @@
from flask import Flask, request
from paddleclas import PaddleClas
from utils import process_request
app = Flask(__name__)
CLAS = PaddleClas(model_name='text_image_orientation')
@app.route('/clas/orientation', methods=['POST'])
@process_request
def orientation():
"""
判断图片旋转角度,逆时针旋转该角度后为正。可能值['0', '90', '180', '270']
:return: 最有可能的两个角度
"""
img_path = request.form.get('img_path')
clas_result = CLAS.predict(input_data=img_path)
clas_result = next(clas_result)[0]
if clas_result['scores'][0] < 0.5:
return ['0', '90']
return clas_result['label_names']
if __name__ == '__main__':
app.run('0.0.0.0', 5005)