-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
31 lines (21 loc) · 857 Bytes
/
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
from flask import Flask, request, render_template
import pickle
with open('bodyFatModelRfr.pickle', 'rb') as f:
model = pickle.load(f)
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def predict():
if request.method == 'POST':
my_dict = request.form
density = float(my_dict['density'])
abdomen = float(my_dict['abdomen'])
chest = float(my_dict['chest'])
weight = float(my_dict['weight'])
hip = float(my_dict['hip'])
input_features = [[density, abdomen, chest, weight, hip]]
prediction = model.predict(input_features)[0].round(2)
string = 'Percentage of Body Fat Estimated is: ' + str(prediction) + '%'
return render_template('show.html', string=string)
return render_template('home.html')
if __name__ == "__main__":
app.run(debug=True)