Anmol58 commited on
Commit
e44c666
·
verified ·
1 Parent(s): 54c0d1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -5
app.py CHANGED
@@ -8,9 +8,22 @@ result=pred[0]
8
 
9
  @app.route('/')
10
  def home():
11
- pred=model.predict([[5,5,0,4.1,3]])
12
- result=pred[0]
13
- return rander_template('index.html',result=result)
14
 
15
- if__name__=='__main__':
16
- app.run(debug=true,host='0.0.0.0')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  @app.route('/')
10
  def home():
11
+ return render_template('index.html')
 
 
12
 
13
+ @app.route('/predict', methods=['POST'])
14
+ def predict():
15
+ if request.method == 'POST':
16
+ # Example: expecting 4 inputs from form (Sepal length, Sepal width, Petal length, Petal width)
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
+ # Make prediction
23
+ pred = model.predict([[sl, sw, pl, pw]])
24
+ result = pred[0] # Predicted class (0,1,2)
25
+
26
+ return render_template('index.html', result=result)
27
+
28
+ if __name__ == '__main__':
29
+ app.run(debug=True, host='0.0.0.0')