Update app.py
Browse files
app.py
CHANGED
|
@@ -12,11 +12,20 @@ result=pred[0]
|
|
| 12 |
def home():
|
| 13 |
return render_template('index.html',result=result)
|
| 14 |
|
| 15 |
-
@app.route('/predict')
|
| 16 |
def predict():
|
| 17 |
-
pred=model.predict([[5,5.0,4.1,3]])
|
| 18 |
-
result=pred[0]
|
| 19 |
-
return result
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
def home():
|
| 13 |
return render_template('index.html',result=result)
|
| 14 |
|
| 15 |
+
@app.route('/predict', methods=['POST'])
|
| 16 |
def predict():
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# Get form values and convert them to float
|
| 19 |
+
sepal_length = float(request.form['sepal_length'])
|
| 20 |
+
sepal_width = float(request.form['sepal_width'])
|
| 21 |
+
petal_length = float(request.form['petal_length'])
|
| 22 |
+
petal_width = float(request.form['petal_width'])
|
| 23 |
+
|
| 24 |
+
# Make prediction
|
| 25 |
+
prediction = model.predict([[sepal_length, sepal_width, petal_length, petal_width]])
|
| 26 |
+
result = prediction[0]
|
| 27 |
+
|
| 28 |
+
return render_template('index.html', result=result)
|
| 29 |
+
|
| 30 |
+
if __name__ == '__main__':
|
| 31 |
+
app.run(debug=True, host='0.0.0.0')
|