修正docker镜像构建
This commit is contained in:
25
services/paddle_services/dewarp_api.py
Normal file
25
services/paddle_services/dewarp_api.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
|
||||
import cv2
|
||||
from flask import Flask, request
|
||||
|
||||
from doc_dewarp import dewarper
|
||||
from utils import process_request, parse_img_path
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/dewarp', methods=['POST'])
|
||||
@process_request
|
||||
def dewarp():
|
||||
img_path = request.form.get('img_path')
|
||||
img = cv2.imread(img_path)
|
||||
dewarped_img = dewarper.dewarp_image(img)
|
||||
dirname, img_name, ext = parse_img_path(img_path)
|
||||
save_path = os.path.join(dirname, img_name + '_dewarped.' + ext)
|
||||
cv2.imwrite(save_path, dewarped_img)
|
||||
return save_path
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run('0.0.0.0', 5007)
|
||||
Reference in New Issue
Block a user