From b387ce871d45d173b8d5aa5cd3ee923708f3a4af Mon Sep 17 00:00:00 2001 From: zhaojinghao Date: Fri, 9 Dec 2022 18:27:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9response?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/run.py b/run.py index 53f02a2..72d68ad 100644 --- a/run.py +++ b/run.py @@ -14,7 +14,7 @@ TEXT = "text" app = Flask(__name__) -@app.route('/house_price', methods=["POST"]) +@app.route('/house_price/', methods=["POST"]) def predict_price(): resp_info = dict() if request.method == 'POST': @@ -61,7 +61,7 @@ def predict_price(): resp_info["data"] = out.getvalue() if resp_info["code"] == 200: resp = make_response(resp_info["data"]) - resp.headers["Content-Disposition"] = "attachment; filename*=utf-8''{}".format("house_price.xlsx") + resp.headers["Content-Disposition"] = "attachment; filename=house_price.xlsx" resp.headers["Content-type"] = "application/x-xlsx" else: resp = make_response(json.dumps(resp_info)) @@ -69,7 +69,7 @@ def predict_price(): return resp -@app.route('/ocean_wave_height', methods=["POST"]) +@app.route('/ocean_wave_height/', methods=["POST"]) def predict_height(): resp_info = dict() if request.method == 'POST': @@ -146,7 +146,7 @@ def run_ts_predict(): resp_info["data"] = out.getvalue() if resp_info.get("code") == 200: resp = make_response(resp_info["data"]) - resp.headers["Content-Disposition"] = "attachment; filename*=utf-8''{}".format(file_name) + resp.headers["Content-Disposition"] = f"attachment; filename={file_name}" resp.headers["Content-type"] = "application/x-xlsx" else: resp = make_response(json.dumps(resp_info))