Closed 670133189 closed 4 years ago
你好,请问如何将paddleOCR设置为http server服务?
目前还没加入这部分代码,尚不支持,后续应该会加。
@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封了
你好,请问如何将paddleOCR设置为http server服务?