File size: 730 Bytes
cf336e7
 
 
 
 
1154d44
6752e79
cf336e7
 
 
493baca
 
e1227d2
493baca
1154d44
 
 
 
 
 
 
 
 
 
 
 
cf336e7
 
1154d44
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
30
from flask import Flask, render_template, request
import joblib

app = Flask(__name__)

# Load the trained model
model = joblib.load('iris_model (3).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")