1 Star 1 Fork 0

JX/full_electronic_invoice

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 908 Bytes
一键复制 编辑 原始数据 按行查看 历史
JX 提交于 2024-10-18 06:05 . update main.py.
from io import BytesIO
import os
from flask import Flask, request, jsonify
from werkzeug.utils import secure_filename
from serve.nlp import ocr_nlp
app = Flask(__name__)
@app.route('/upload', methods=['POST'])
def upload_file():
if 'file' not in request.files:
return jsonify({'message': 'No file part in the request'}), 400
file = request.files['file']
# 如果用户没有选择文件,浏览器也会提交一个空的表单
if file.filename == '':
return jsonify({'message': 'No selected file'}), 400
if file:
filename = secure_filename(file.filename)
filepath = os.path.join('tmp/upload', filename)
file.save(os.path.join('tmp/upload', filename))
nlp_data = ocr_nlp('tmp/upload', filename)
return jsonify(nlp_data), 201
if __name__ == '__main__':
#app.run(debug=True)
app.run(debug=True,host='0.0.0.0', port=9887)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xoc/full_electronic_invoice.git
git@gitee.com:xoc/full_electronic_invoice.git
xoc
full_electronic_invoice
full_electronic_invoice
master

搜索帮助