from flask import Flask, render_template, request import joblib app = Flask(__name__) # Load the trained model model = joblib.load('iris_model.pkl') @app.route("/") def home(): return render_template("index.html") @app.route("/predict", methods=['POST']) def predict(): if request.method == 'POST': # Get values from form sl = float(request.form['sl']) sw = float(request.form['sw']) pl = float(request.form['pl']) pw = float(request.form['pw']) # Make prediction pred = model.predict([[sl, sw, pl, pw]]) result = pred[0] return render_template("index.html", data=result) if __name__ == '__main__': app.run(debug=True, host="0.0.0.0")