nayyabzahra148's picture
Create app.py
d5a3f17
import pickle
import gradio as gr
with open("Condition_Model","rb") as f:
mp=pickle.load(f)
def Conditional_Prediction(Gender,Height,Weight):
Gen=0
if(Gender=="Male"):
Gen=1
elif(Gender=="Female"):
Gen=0
Height=float(Height)
Weight=float(Weight)
result=mp.predict([[Gen,Height,Weight]])
print(result[0])
if result[0]==0:
final_result="You have Extremely Weak Body Condition"
elif result[0]==1:
final_result="You have Weak Body Condition"
elif result[0]==2:
final_result="You have Normal Body Condition"
elif result[0]==3:
final_result="You have Estimated Overweight"
elif result[0]==4:
final_result="You have Estimated Obesity"
elif result[0]==5:
final_result="You seem to have Extreme Obesity"
return final_result
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")],
outputs=[gr.outputs.Textbox(label="Your Estimated Condition")],
enable_queu=True)
interface.launch(debug=True)