PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
44.05k stars 7.81k forks source link

paddleOCR设置为http服务 #59

Closed 670133189 closed 4 years ago

670133189 commented 4 years ago

你好,请问如何将paddleOCR设置为http server服务?

LDOUBLEV commented 4 years ago

你好,请问如何将paddleOCR设置为http server服务?

目前还没加入这部分代码,尚不支持,后续应该会加。

gekie commented 4 years ago

@app.route('/recognitionObject',methods=['POST'],strict_slashes=False) def recognition_object(): intime = time.time()*1000 f = request.files['imageFile'] if 'imageFile' in request.files else None imageData = get_param('imageData','') back_split_acc = get_param('backAcc','false') back_split_acc = True if back_split_acc=='true' else False result = {} if f : ext_name = f.filename.split('.', 1)[1].lower() if ext_name not in ['pdf','jpg','png','jpeg']: result['errorCode'] = 101 result['message'] = '图片格式不允许' else: fn = str(int(intime))+'.'+ext_name fn = os.path.join(app_data_path,fn) f.save(fn) obj = recongnition_invoice_image(fn,back_split_acc=back_split_acc,rotate_all=False) if obj is None: result['errorCode'] = 102 result['message'] = '图片内容为空' else: result['errorCode'] =0 result['content'] = obj else: result['errorCode'] = 103 result['messgae'] = '图片为空' return obj_to_jsonstr(result)

我自己了,提供http api封了