File size: 725 Bytes
40c4df3 64f5593 40c4df3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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") |