Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import matplotlib.pyplot as plt
|
| 3 |
-
from datetime import datetime
|
| 4 |
|
| 5 |
st.set_page_config(page_title="BMI Calculator", page_icon="βοΈ")
|
| 6 |
st.title("βοΈ BMI Calculator")
|
|
@@ -38,11 +37,6 @@ def get_avg_hw(age, group):
|
|
| 38 |
avg_height, avg_weight = get_avg_hw(age, category)
|
| 39 |
st.info(f"π Average for {category}, Age {age}: Height β {avg_height} cm | Weight β {avg_weight} kg")
|
| 40 |
|
| 41 |
-
# Date selector
|
| 42 |
-
st.subheader("π
Date of Measurement")
|
| 43 |
-
year = st.selectbox("Year", list(range(datetime.now().year, 1900, -1)))
|
| 44 |
-
month = st.selectbox("Month", list(range(1, 13)))
|
| 45 |
-
|
| 46 |
# Height input unit toggle
|
| 47 |
height_unit = st.radio("Choose height input unit", ["Centimeters (cm)", "Feet & Inches"])
|
| 48 |
|
|
@@ -86,9 +80,8 @@ if height_m > 0 and weight_kg > 0:
|
|
| 86 |
|
| 87 |
category_label = bmi_category(bmi, category)
|
| 88 |
|
| 89 |
-
# Display result
|
| 90 |
-
|
| 91 |
-
st.success(f"Your BMI on **{month_name} {year}** is **{bmi}** ({category_label})")
|
| 92 |
|
| 93 |
# Graphical representation
|
| 94 |
st.subheader("π BMI Category Ranges")
|
|
@@ -116,3 +109,4 @@ if height_m > 0 and weight_kg > 0:
|
|
| 116 |
st.pyplot(fig)
|
| 117 |
|
| 118 |
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import matplotlib.pyplot as plt
|
|
|
|
| 3 |
|
| 4 |
st.set_page_config(page_title="BMI Calculator", page_icon="βοΈ")
|
| 5 |
st.title("βοΈ BMI Calculator")
|
|
|
|
| 37 |
avg_height, avg_weight = get_avg_hw(age, category)
|
| 38 |
st.info(f"π Average for {category}, Age {age}: Height β {avg_height} cm | Weight β {avg_weight} kg")
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
# Height input unit toggle
|
| 41 |
height_unit = st.radio("Choose height input unit", ["Centimeters (cm)", "Feet & Inches"])
|
| 42 |
|
|
|
|
| 80 |
|
| 81 |
category_label = bmi_category(bmi, category)
|
| 82 |
|
| 83 |
+
# Display result
|
| 84 |
+
st.success(f"Your BMI is **{bmi}** ({category_label})")
|
|
|
|
| 85 |
|
| 86 |
# Graphical representation
|
| 87 |
st.subheader("π BMI Category Ranges")
|
|
|
|
| 109 |
st.pyplot(fig)
|
| 110 |
|
| 111 |
|
| 112 |
+
|