我想通过单击按钮来调用train_predict
<a href="{{url_for('train_predict')}}"><button>Train</button></a>`
在train_predict中:-
@app.route('/train_predict')
# def train_predict():
# prediction = importing_haar_cascade.trains()
# print(prediction)
# return redirect(url_for('upload_file'))
importing_haar_cascase.trains()包含
def trains():
training_data, training_labels, prediction = make_sets()
print ("training fisher face classifier")
print ("size of training set is:", len(training_labels), "images")
fishface.train(training_data, np.asarray(training_labels))
print ("predicting classification set")
return prediction
每次我要预测时,都要花时间训练。 因此,我想要一种简单的方法,只需单击一次按钮即可执行一次,并在整个会话过程中使用“预测”