Spaces:
Runtime error
Runtime error
abdouramandalil
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
st.title('Welcome to the BMI Calculator')
|
3 |
+
|
4 |
+
weight = st.number_input("Enter your weight in Kgs")
|
5 |
+
status = st.radio("Select your height format",("cms","meters","feet"))
|
6 |
+
|
7 |
+
try:
|
8 |
+
if status == "cms":
|
9 |
+
height = st.number_input('Centimeters')
|
10 |
+
bmi = weight/((height/100)**2)
|
11 |
+
|
12 |
+
elif status == "meters":
|
13 |
+
height = st.number_input('meters')
|
14 |
+
bmi = weight/((height)**2)
|
15 |
+
else:
|
16 |
+
height = st.number_input('feet')
|
17 |
+
bmi = weight/((height/3.28)**2)
|
18 |
+
except:
|
19 |
+
print('Zero division Error')
|
20 |
+
|
21 |
+
if (st.button('Calculate BMI')):
|
22 |
+
st.write("Your BMI index is {}.".format(round(bmi)))
|
23 |
+
if bmi < 16:
|
24 |
+
st.error('You are extremely underweight')
|
25 |
+
elif (bmi>=16 and bmi<18.5):
|
26 |
+
st.warning('You are underweight')
|
27 |
+
elif (bmi>=18.5 and bmi<25):
|
28 |
+
st.success('You are Healthy')
|
29 |
+
elif (bmi>=25 and bmi<30):
|
30 |
+
st.warning('You are Overweight')
|
31 |
+
else:
|
32 |
+
st.error('extremely Overweight')
|
33 |
+
|
34 |
+
|
35 |
+
|