做人脸识别,截取下来的人脸图片会在本地保存起来。
业务系统,希望通过一个 http 服务访问这些图片。
我用flask,简单搭建了和一个图片服务,
# encoding:utf8
__author__ = 'sijiu'
from flask import Response, Flask, request
app = Flask(__name__)
@app.route("/image", methods=['post', 'get'])
def index():
path = request.args.get('path')
print(path)
path = "/home/sijiu.duan/dev/Icarus/ang/faces/%s" % path
resp = Response(open(path, 'rb'), mimetype="image/jpeg")
return resp
app.run(host='0.0.0.0',port=4949, debug=True)