Team Ai
Apppublic

prabh1309/Iris-Classification-Visualization

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
app.py29 linesDownload Raw Back to root
1from flask import Flask, render_template, request2from sklearn.linear_model import LogisticRegression3import joblib4 5app = Flask(__name__)6 7# Load model8model = joblib.load('iris_model1.joblib')9 10 11@app.route('/')12def home():13    return render_template('index.html')14 15@app.route('/predict', methods=['POST'])16def predict():17  sl = float(request.form['sepal_length'])18  sw = float(request.form['sepal_width'])19  pl = float(request.form['petal_length'])20  pw = float(request.form['petal_width'])21 22  # Predict species23  input_data = [[sl, sw, pl, pw]]24  pred = model.predict(input_data)25 26  return render_template('index.html', data=pred[0])27 28if __name__ == '__main__':29    app.run(debug=True)