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))