-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
app.py
70 lines (55 loc) · 1.49 KB
/
app.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""
docstring
"""
from flask import Flask, render_template, request
from MachineLearningCode import MachineLearningCode
# apps initializations
app = Flask(__name__)
print("Flask app initialized")
MLC = MachineLearningCode()
# routes definitions
@app.route('/')
@app.route('/home')
def hello_world():
"""
docstring
"""
print("Hello World!")
return render_template("home.html")
@app.route('/predict', methods=['GET','POST'])
def predictandoutput():
"""
docstring
"""
print("Inside predictandoutput function")
MLC.train()
sepal_length = request.form["slengthin"]
sepal_width = request.form["swidthin"]
petal_length = request.form["plengthin"]
petal_width = request.form["pwidthin"]
sepal_length, sepal_width, petal_length, petal_width = ( float(sepal_length),
float(sepal_width), float(petal_length), float(petal_width))
result = MLC.predict(sepal_length, sepal_width, petal_length, petal_width)
return render_template("result.html", Predicted_flower_name=result[0][0],
Accuracy_of_prediction=int(result[1]*100))
@app.route('/dashboard')
def dashboard():
"""
docstring
"""
return render_template("dashboard.html")
@app.route('/about')
def about():
"""
docstring
"""
return render_template("about.html")
@app.route('/prediction')
def prediction():
"""
docstring
"""
return render_template("index.html")
# app run
if __name__ == '__main__':
app.run(debug=True)