Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,29 +1,20 @@
|
|
| 1 |
-
# import streamlit as st
|
| 2 |
-
# st.title("BMI CALCULATOR ")
|
| 3 |
-
# weight= st.user_input("Enter Your Weight (KG): ", min_value = 1.0,format= "%.2f")
|
| 4 |
-
import streamlit as st
|
| 5 |
|
| 6 |
-
|
| 7 |
st.title("BMI Calculator 🏋️♂️")
|
| 8 |
|
| 9 |
-
# User inputs for weight and height
|
| 10 |
weight = st.number_input("Enter your weight (kg):", min_value=1.0, format="%.2f")
|
| 11 |
|
| 12 |
height_unit = st.selectbox("Select height unit:", ["Centimeters", "Meters", "Feet"])
|
| 13 |
height = st.number_input("Enter your height:", min_value=1.0, format="%.2f")
|
| 14 |
-
|
| 15 |
-
# Convert height to meters
|
| 16 |
if height_unit == "Centimeters":
|
| 17 |
height = height / 100
|
| 18 |
elif height_unit == "Feet":
|
| 19 |
-
height = height * 0.3048
|
| 20 |
|
| 21 |
-
# BMI Calculation
|
| 22 |
if height > 0:
|
| 23 |
bmi = weight / (height ** 2)
|
| 24 |
st.write(f"### Your BMI: {bmi:.2f}")
|
| 25 |
|
| 26 |
-
# BMI Categories
|
| 27 |
if bmi < 18.5:
|
| 28 |
st.warning("You are underweight.")
|
| 29 |
elif 18.5 <= bmi < 24.9:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
+
import streamlit as st
|
| 3 |
st.title("BMI Calculator 🏋️♂️")
|
| 4 |
|
|
|
|
| 5 |
weight = st.number_input("Enter your weight (kg):", min_value=1.0, format="%.2f")
|
| 6 |
|
| 7 |
height_unit = st.selectbox("Select height unit:", ["Centimeters", "Meters", "Feet"])
|
| 8 |
height = st.number_input("Enter your height:", min_value=1.0, format="%.2f")
|
|
|
|
|
|
|
| 9 |
if height_unit == "Centimeters":
|
| 10 |
height = height / 100
|
| 11 |
elif height_unit == "Feet":
|
| 12 |
+
height = height * 0.3048
|
| 13 |
|
|
|
|
| 14 |
if height > 0:
|
| 15 |
bmi = weight / (height ** 2)
|
| 16 |
st.write(f"### Your BMI: {bmi:.2f}")
|
| 17 |
|
|
|
|
| 18 |
if bmi < 18.5:
|
| 19 |
st.warning("You are underweight.")
|
| 20 |
elif 18.5 <= bmi < 24.9:
|