-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.py
58 lines (35 loc) · 1.35 KB
/
run.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
from flask import Flask, render_template, url_for, redirect, request
import numpy as np
import pickle
from forms import CheckForm
app = Flask(__name__)
app.config['SECRET_KEY']='GTHACKERS'
model = pickle.load(open('model.pkl', 'rb'))
@app.route('/')
def home():
return render_template('GT home.html')
@app.route('/about')
def about():
return render_template('about.html')
@app.route('/contact')
def contact():
return render_template('contact.html')
@app.route('/predict',methods=['GET','POST'])
def predict():
# int_features = [1, 3, 565235956.44242, 13959898.5346, 5464.5434, 21545.54534354, 564.4323434]
form = CheckForm()
if form.is_submitted():
result = request.form.values()
a = list(result)
a.remove('Submit')
a.remove(form.D_name.data)
a.remove(form.P_name.data)
a=[int(x) for x in a]
final_features = [np.array(a)]
prediction=model.predict(final_features)
return render_template('answer.html',prediction=prediction)
# final_features = [np.array(int_features)]
# prediction = model.predict(final_features)
return render_template('formsection.html', form=form)
if __name__ == '__main__':
app.run(debug=True)