Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,45 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
st.title("
|
| 5 |
-
st.write("This is a simple Streamlit app deployed on Hugging Face Spaces.")
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
# App Title
|
| 4 |
+
st.title("ποΈ Streamlit Fitness Advisor")
|
|
|
|
| 5 |
|
| 6 |
+
# User Input: Age
|
| 7 |
+
age = st.slider("Select your age", min_value=10, max_value=80, value=25)
|
| 8 |
+
|
| 9 |
+
# User Input: Fitness Goal
|
| 10 |
+
goal = st.selectbox(
|
| 11 |
+
"What is your main fitness goal?",
|
| 12 |
+
["Lose Weight", "Build Muscle", "Increase Endurance", "General Fitness"]
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
# User Input: Activity Level
|
| 16 |
+
activity_level = st.select_slider(
|
| 17 |
+
"How active are you?",
|
| 18 |
+
options=["Sedentary", "Lightly Active", "Moderately Active", "Very Active"],
|
| 19 |
+
value="Moderately Active"
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# Logic for Workout Recommendation
|
| 23 |
+
def get_workout_recommendation(age, goal, activity_level):
|
| 24 |
+
if goal == "Lose Weight":
|
| 25 |
+
if activity_level in ["Sedentary", "Lightly Active"]:
|
| 26 |
+
return "π 30-45 minutes of cardio (walking, cycling) + light strength training."
|
| 27 |
+
else:
|
| 28 |
+
return "ποΈ HIIT workouts + resistance training 3-4 times per week."
|
| 29 |
+
|
| 30 |
+
elif goal == "Build Muscle":
|
| 31 |
+
if age < 30:
|
| 32 |
+
return "πͺ Strength training 4-5 times per week + protein-rich diet."
|
| 33 |
+
else:
|
| 34 |
+
return "πͺ Focus on compound lifts (squats, deadlifts) + adequate recovery."
|
| 35 |
+
|
| 36 |
+
elif goal == "Increase Endurance":
|
| 37 |
+
return "πββοΈ Running, cycling, or swimming 4-6 times per week with progressive overload."
|
| 38 |
+
|
| 39 |
+
else:
|
| 40 |
+
return "π€Έ Balanced mix of cardio, strength training, and flexibility exercises."
|
| 41 |
+
|
| 42 |
+
# Display Recommendation
|
| 43 |
+
recommendation = get_workout_recommendation(age, goal, activity_level)
|
| 44 |
+
st.subheader("π Your Personalized Workout Plan:")
|
| 45 |
+
st.write(recommendation)
|