| from flask import Flask, render_template, request |
| from sklearn.linear_model import LogisticRegression |
| import joblib |
|
|
| app = Flask(__name__) |
|
|
| |
| model = joblib.load('iris_model1.joblib') |
|
|
|
|
| @app.route('/') |
| def home(): |
| return render_template('index.html') |
|
|
| @app.route('/predict', methods=['POST']) |
| def predict(): |
| sl = float(request.form['sepal_length']) |
| sw = float(request.form['sepal_width']) |
| pl = float(request.form['petal_length']) |
| pw = float(request.form['petal_width']) |
|
|
| |
| input_data = [[sl, sw, pl, pw]] |
| pred = model.predict(input_data) |
|
|
| return render_template('index.html', data=pred[0]) |
|
|
| if __name__ == '__main__': |
| app.run(debug=True) |