test1 / app.py
umer70112254's picture
Create app.py
ba4003c
raw
history blame
2.04 kB
import streamlit as st
def calculate_bmi(weight, height):
return weight / ((height / 100) ** 2)
def determine_weight_status(bmi):
if bmi < 18.5:
return 'Underweight'
elif 18.5 <= bmi < 25:
return 'Normal'
elif 25 <= bmi < 30:
return 'Overweight'
else:
return 'Obese'
def determine_height_status(height, age_months):
# You'd typically use growth charts or specific data for this calculation
# Here's a placeholder example
if age_months < 60:
if height < 110:
return 'Stunted (Low Height-for-Age)'
elif 110 <= height <= 150:
return 'Normal Height'
else:
return 'Tall for Age'
else:
return 'Height Status Not Applicable'
def poshan_tracker_calculator(gender, age_months, weight, height):
bmi = calculate_bmi(weight, height)
weight_status = determine_weight_status(bmi)
height_status = determine_height_status(height, age_months)
st.write(f"Child Gender: {gender.capitalize()}")
st.write(f"Child Age: {age_months} Months")
st.write(f"Child Weight: {weight:.2f} kg")
st.write(f"Child Height: {height:.2f} cm")
st.write(f"Child BMI: {bmi:.2f}")
st.write(f"Weight Status: {weight_status}")
st.write(f"Height Status: {height_status}")
st.write("Recommended Height Range: 110 - 150 cm") # Placeholder range
st.write("Growth Status: Abnormal Growth") # Placeholder status
st.write("Disclaimer: Don't Rely on the calculator, Consult With Medical Professional")
# Streamlit UI
st.title('Poshan Tracker Calculator')
gender = st.radio('Select Child Gender:', ('Male', 'Female'))
age_months = st.number_input('Enter Child Age in Months:', min_value=0, max_value=300, value=24)
weight = st.number_input('Enter Child Weight in kg:', min_value=0.1, max_value=200.0, value=10.0)
height = st.number_input('Enter Child Height in cm:', min_value=30, max_value=200, value=100)
if st.button('Calculate'):
poshan_tracker_calculator(gender, age_months, weight, height)