-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
34 lines (24 loc) · 988 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
31
32
33
34
from flask import Flask, request, render_template
from markupsafe import escape
import pickle
file = open("body_fat_model.pkl", "rb")
rf = pickle.load(file)
file.close()
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 = rf.predict(input_features)[0].round(2)
# <p class="big-font">Hello World !!</p>', unsafe_allow_html=True
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)