from KNN import *
from flask import Flask,request,render_template
app = Flask(__name__)
@app.route('/',methods=['GET','POST'])
def home():
return render_template('web.html')
@app.route('/training',methods=['GET','POST'])
def training():
pos_path = request.form['positivepath']
neg_path = request.form['negativepath']
Precision,A,B,C,D = algorithm()
return render_template('result.html',precision=Precision,posright=A,poswrong=B,negright=C,negwrong=D)
if name == '__main__':
app.run()
代码如上,运行后输入localhost:5000能到达web.html,但是提交表单后无法到result.html页面,总是提示Bad Request
The browser (or proxy) sent a request that this server could not understand.