-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
39 lines (24 loc) · 1.16 KB
/
Copy pathapp.py
File metadata and controls
39 lines (24 loc) · 1.16 KB
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
from flask import Flask, render_template, request
import pickle
app = Flask(__name__)
model = pickle.load(open('bank_note_knn.pkl', 'rb'))
@app.route('/',methods=['GET'])
def Home():
return render_template('index.html')
@app.route("/predict", methods=['POST'])
def predict():
if request.method == 'POST':
variance = float(request.form['variance'])
skewness = float(request.form['skewness'])
curtosis = float(request.form['curtosis'])
entropy = float(request.form['entropy'])
prediction=model.predict([[variance, skewness, curtosis, entropy]])
output = prediction
if output == 0:
return render_template('index.html',prediction_text="The note is legit", variance=variance, skewness=skewness, curtosis=curtosis, entropy=entropy)
else:
return render_template('index.html',prediction_text="The note is not legit", variance=variance, skewness=skewness, curtosis=curtosis, entropy=entropy)
else:
return render_template('index.html')
if __name__=="__main__":
app.run(debug=True)