lily0n commited on
Commit
6f1abf4
Β·
verified Β·
1 Parent(s): 94b764a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -6
app.py CHANGED
@@ -1,9 +1,45 @@
1
  import streamlit as st
2
 
3
- # Streamlit App
4
- st.title("Hello, Hugging Face!")
5
- st.write("This is a simple Streamlit app deployed on Hugging Face Spaces.")
6
 
7
- name = st.text_input("Enter your name:")
8
- if name:
9
- st.write(f"Hello, {name}!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)