Spaces:
Sleeping
Sleeping
nayyabzahra148
commited on
Commit
•
d5a3f17
1
Parent(s):
2a48efa
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
with open("Condition_Model","rb") as f:
|
5 |
+
mp=pickle.load(f)
|
6 |
+
def Conditional_Prediction(Gender,Height,Weight):
|
7 |
+
Gen=0
|
8 |
+
if(Gender=="Male"):
|
9 |
+
Gen=1
|
10 |
+
elif(Gender=="Female"):
|
11 |
+
Gen=0
|
12 |
+
|
13 |
+
Height=float(Height)
|
14 |
+
Weight=float(Weight)
|
15 |
+
|
16 |
+
result=mp.predict([[Gen,Height,Weight]])
|
17 |
+
print(result[0])
|
18 |
+
if result[0]==0:
|
19 |
+
final_result="You have Extremely Weak Body Condition"
|
20 |
+
elif result[0]==1:
|
21 |
+
final_result="You have Weak Body Condition"
|
22 |
+
elif result[0]==2:
|
23 |
+
final_result="You have Normal Body Condition"
|
24 |
+
elif result[0]==3:
|
25 |
+
final_result="You have Estimated Overweight"
|
26 |
+
elif result[0]==4:
|
27 |
+
final_result="You have Estimated Obesity"
|
28 |
+
elif result[0]==5:
|
29 |
+
final_result="You seem to have Extreme Obesity"
|
30 |
+
return final_result
|
31 |
+
|
32 |
+
interface=gr.Interface(fn=Conditional_Prediction,inputs=[gr.inputs.Radio(["Male","Female"],type="value",label="Gender"),gr.inputs.Textbox(lines=2,placeholder="Enter Your Height"),gr.inputs.Textbox(lines=2,placeholder="Enter Your Weight")],
|
33 |
+
outputs=[gr.outputs.Textbox(label="Your Estimated Condition")],
|
34 |
+
enable_queu=True)
|
35 |
+
interface.launch(debug=True)
|