File size: 882 Bytes
ace1d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d547a1
 
 
ace1d3a
 
 
 
 
 
 
 
 
8d547a1
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from flask import *
import seaborn as sns
from sklearn.linear_model import LogisticRegression



app = Flask(__name__)



@app.route('/predict', methods =['POST'])
def predictflower():
   # receive all four values
   # send these 4 values to predict method of model
   # return the flower type returned by predict method
   # def greet_json():
   iris1 =sns.load_dataset("iris")
   modlog= LogisticRegression (max_iter=300)
   
   irisarr = iris1.values
   X = irisarr[:,0:4]
   Y = irisarr[:,4]


   modlog.fit(X,Y)



   sl = float(request.form['sl'])
   sw = float(request.form['sw'] )
   pl = float(request.form['pl'])
   pw = float(request.form['pw'])
   res = modlog.predict([[ sl , sw ,pl ,pw ] ])
  
   return render_template("form.html" , result = res )



@app.route('/')
def hello_world():
 return render_template("form.html")





if __name__ == '__main__':
 app.run()