Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +59 -14
src/streamlit_app.py
CHANGED
|
@@ -1,16 +1,61 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
st.
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
)
|
| 15 |
-
|
| 16 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
st.set_page_config(page_title="AI Fitness Plan Generator", page_icon="๐ช", layout="centered")
|
| 4 |
+
|
| 5 |
+
st.markdown("""
|
| 6 |
+
<style>
|
| 7 |
+
.main {
|
| 8 |
+
background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
|
| 9 |
+
}
|
| 10 |
+
label, .stTextInput label, .stSelectbox label {
|
| 11 |
+
color: white !important;
|
| 12 |
+
}
|
| 13 |
+
</style>
|
| 14 |
+
""", unsafe_allow_html=True)
|
| 15 |
+
|
| 16 |
+
st.title("๐ช AI Fitness Plan Generator")
|
| 17 |
+
st.write("Get a personalized fitness plan based on your details")
|
| 18 |
+
|
| 19 |
+
# User Inputs
|
| 20 |
+
age = st.number_input("Age", min_value=10, max_value=100, step=1)
|
| 21 |
+
gender = st.selectbox("Gender", ["Male", "Female", "Other"])
|
| 22 |
+
goal = st.selectbox("Fitness Goal", ["Weight Loss", "Muscle Gain", "General Fitness"])
|
| 23 |
+
activity = st.selectbox("Activity Level", ["Low", "Medium", "High"])
|
| 24 |
+
|
| 25 |
+
# Plan Logic
|
| 26 |
+
|
| 27 |
+
def generate_plan(age, goal, activity):
|
| 28 |
+
plan = ""
|
| 29 |
+
|
| 30 |
+
if goal == "Weight Loss":
|
| 31 |
+
plan = "๐ Cardio 4โ5 days/week, strength training 2โ3 days/week, calorie-controlled diet."
|
| 32 |
+
elif goal == "Muscle Gain":
|
| 33 |
+
plan = "๐๏ธ Strength training 4โ5 days/week, high-protein diet, proper sleep and recovery."
|
| 34 |
+
else:
|
| 35 |
+
plan = "๐คธ Combination of cardio & strength training 3โ4 days/week, balanced nutrition."
|
| 36 |
+
|
| 37 |
+
if activity == "Low":
|
| 38 |
+
plan += " Start with light intensity and gradually increase."
|
| 39 |
+
elif activity == "Medium":
|
| 40 |
+
plan += " Maintain moderate intensity workouts."
|
| 41 |
+
else:
|
| 42 |
+
plan += " Include high-intensity workouts with proper rest days."
|
| 43 |
+
|
| 44 |
+
return plan
|
| 45 |
+
|
| 46 |
+
# Button
|
| 47 |
+
if st.button("Generate Fitness Plan"):
|
| 48 |
+
plan = generate_plan(age, goal, activity)
|
| 49 |
+
st.success("Your Personalized Fitness Plan")
|
| 50 |
+
st.markdown(f"""
|
| 51 |
+
**Age:** {age}
|
| 52 |
+
**Gender:** {gender}
|
| 53 |
+
**Goal:** {goal}
|
| 54 |
+
**Activity Level:** {activity}
|
| 55 |
+
|
| 56 |
+
---
|
| 57 |
+
{plan}
|
| 58 |
+
""")
|
| 59 |
+
|
| 60 |
+
st.markdown("---")
|
| 61 |
+
st.caption("๐ Built with Streamlit | Ready for AI integration")
|