from flask import * import seaborn as sns from sklearn.linear_model import LogisticRegression app = Flask(__name__) @app.route('/predict', methods =['POST']) def predictflower(): # receive all four values # send these 4 values to predict method of model # return the flower type returned by predict method # def greet_json(): iris1 =sns.load_dataset("iris") modlog= LogisticRegression (max_iter=300) irisarr = iris1.values X = irisarr[:,0:4] Y = irisarr[:,4] modlog.fit(X,Y) sl = float(request.form['sl']) sw = float(request.form['sw'] ) pl = float(request.form['pl']) pw = float(request.form['pw']) res = modlog.predict([[ sl , sw ,pl ,pw ] ]) return render_template("form.html" , result = res ) @app.route('/') def hello_world(): return render_template("form.html") if __name__ == '__main__': app.run()