Spaces:
Running
Running
Delete src/streamlit_app.py
Browse files- src/streamlit_app.py +0 -82
src/streamlit_app.py
DELETED
|
@@ -1,82 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
|
| 3 |
-
st.set_page_config(page_title="FitPlan AI - BMI Calculator", page_icon="💪")
|
| 4 |
-
|
| 5 |
-
st.title("💪 FitPlan AI - Fitness Profile & BMI Calculator")
|
| 6 |
-
|
| 7 |
-
st.write("Fill in your details to calculate your BMI and fitness category.")
|
| 8 |
-
|
| 9 |
-
# -------------------------
|
| 10 |
-
# 1. Personal Information
|
| 11 |
-
# -------------------------
|
| 12 |
-
|
| 13 |
-
name = st.text_input("Enter Your Name *")
|
| 14 |
-
|
| 15 |
-
height_cm = st.number_input("Enter Height (in centimeters) *", min_value=0.0, format="%.2f")
|
| 16 |
-
weight_kg = st.number_input("Enter Weight (in kilograms) *", min_value=0.0, format="%.2f")
|
| 17 |
-
|
| 18 |
-
# -------------------------
|
| 19 |
-
# 2. Fitness Details
|
| 20 |
-
# -------------------------
|
| 21 |
-
|
| 22 |
-
st.subheader("Fitness Details")
|
| 23 |
-
|
| 24 |
-
goal = st.selectbox(
|
| 25 |
-
"Select Your Fitness Goal",
|
| 26 |
-
["Build Muscle", "Weight Loss", "Strength Gain", "Abs Building", "Flexible"]
|
| 27 |
-
)
|
| 28 |
-
|
| 29 |
-
equipment = st.multiselect(
|
| 30 |
-
"Available Equipment (Select multiple if available)",
|
| 31 |
-
["Dumbbells", "Resistance Band", "Yoga Mat", "Skipping Rope",
|
| 32 |
-
"Weight Plates", "Cycling", "Inclined Bench", "Pullups Bar", "No Equipment"]
|
| 33 |
-
)
|
| 34 |
-
|
| 35 |
-
fitness_level = st.radio(
|
| 36 |
-
"Select Your Fitness Level",
|
| 37 |
-
["Beginner", "Intermediate", "Advanced"]
|
| 38 |
-
)
|
| 39 |
-
|
| 40 |
-
# -------------------------
|
| 41 |
-
# BMI Calculation Function
|
| 42 |
-
# -------------------------
|
| 43 |
-
|
| 44 |
-
def calculate_bmi(weight, height_cm):
|
| 45 |
-
height_m = height_cm / 100 # Convert cm to meters
|
| 46 |
-
bmi = weight / (height_m ** 2)
|
| 47 |
-
return round(bmi, 2)
|
| 48 |
-
|
| 49 |
-
def bmi_category(bmi):
|
| 50 |
-
if bmi < 18.5:
|
| 51 |
-
return "Underweight"
|
| 52 |
-
elif 18.5 <= bmi < 24.9:
|
| 53 |
-
return "Normal"
|
| 54 |
-
elif 25 <= bmi < 29.9:
|
| 55 |
-
return "Overweight"
|
| 56 |
-
else:
|
| 57 |
-
return "Obese"
|
| 58 |
-
|
| 59 |
-
# -------------------------
|
| 60 |
-
# Submit Button
|
| 61 |
-
# -------------------------
|
| 62 |
-
|
| 63 |
-
if st.button("Calculate BMI"):
|
| 64 |
-
|
| 65 |
-
# Validation
|
| 66 |
-
if not name or height_cm <= 0 or weight_kg <= 0:
|
| 67 |
-
st.error("⚠ Please fill all required fields with valid values!")
|
| 68 |
-
else:
|
| 69 |
-
bmi = calculate_bmi(weight_kg, height_cm)
|
| 70 |
-
category = bmi_category(bmi)
|
| 71 |
-
|
| 72 |
-
st.success("✅ Calculation Successful!")
|
| 73 |
-
|
| 74 |
-
st.write(f"### 👤 Name: {name}")
|
| 75 |
-
st.write(f"### 📊 Your BMI: {bmi}")
|
| 76 |
-
st.write(f"### 🏷 BMI Category: {category}")
|
| 77 |
-
|
| 78 |
-
st.write("---")
|
| 79 |
-
st.write("### 🏋 Fitness Summary")
|
| 80 |
-
st.write(f"**Goal:** {goal}")
|
| 81 |
-
st.write(f"**Fitness Level:** {fitness_level}")
|
| 82 |
-
st.write(f"**Equipment Available:** {', '.join(equipment) if equipment else 'None selected'}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|