Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,8 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Function to calculate calories burned during swimming
|
4 |
-
def calories_swim(time_hr,
|
5 |
METS = 10 # Metabolic Equivalent for swimming
|
6 |
-
weight_kg = 175 * 0.453592
|
7 |
return (time_hr * METS * 3.5 * weight_kg) / 200
|
8 |
|
9 |
# Function to calculate calories burned during pull-ups
|
@@ -14,7 +13,58 @@ def calories_pullup(weight, reps):
|
|
14 |
|
15 |
# Streamlit UI
|
16 |
st.title("Calories Burned Calculator πββοΈπͺ")
|
17 |
-
st.sidebar.header("Input Parameters")
|
18 |
|
19 |
# Swimming parameters
|
20 |
-
time_swim = st.sidebar.slider("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
# Function to calculate calories burned during swimming
|
4 |
+
def calories_swim(time_hr, weight_kg):
|
5 |
METS = 10 # Metabolic Equivalent for swimming
|
|
|
6 |
return (time_hr * METS * 3.5 * weight_kg) / 200
|
7 |
|
8 |
# Function to calculate calories burned during pull-ups
|
|
|
13 |
|
14 |
# Streamlit UI
|
15 |
st.title("Calories Burned Calculator πββοΈπͺ")
|
16 |
+
st.sidebar.header("Input Parameters π οΈ")
|
17 |
|
18 |
# Swimming parameters
|
19 |
+
time_swim = st.sidebar.slider("Swimming Time (hours)", 0.0, 5.0, 2.0)
|
20 |
+
weight = st.sidebar.number_input("Your weight (lbs)", 100, 300, 175)
|
21 |
+
|
22 |
+
# Ring Exercise parameters
|
23 |
+
reps = st.sidebar.slider("Number of Pull-Ups", 0, 500, 400)
|
24 |
+
|
25 |
+
st.sidebar.subheader("Choose Exercise Type π€ΈββοΈ")
|
26 |
+
exercise_type = st.sidebar.selectbox(
|
27 |
+
"",
|
28 |
+
["Swim Jim πββοΈ", "Ring King π", "Both Boost π"]
|
29 |
+
)
|
30 |
+
|
31 |
+
st.sidebar.subheader("Choose Swim Style π")
|
32 |
+
swim_style = st.sidebar.selectbox(
|
33 |
+
"",
|
34 |
+
["Frog Kick πΈ", "Dolphin Kick π¬", "Butterfly π¦"]
|
35 |
+
)
|
36 |
+
|
37 |
+
st.sidebar.subheader("Choose Ring Style πͺ")
|
38 |
+
ring_style = st.sidebar.selectbox(
|
39 |
+
"",
|
40 |
+
["Standard π", "Mixed Grip β¨", "Wide Grip π "]
|
41 |
+
)
|
42 |
+
|
43 |
+
# Calculation
|
44 |
+
weight_kg = weight * 0.453592
|
45 |
+
calories_from_swimming = calories_swim(time_swim, weight_kg)
|
46 |
+
calories_from_pullups = calories_pullup(weight, reps)
|
47 |
+
|
48 |
+
# Display
|
49 |
+
st.subheader(f"Calories Burned π₯")
|
50 |
+
if exercise_type == "Swim Jim πββοΈ":
|
51 |
+
st.write(f"Calories burned from swimming: {calories_from_swimming:.2f}")
|
52 |
+
elif exercise_type == "Ring King π":
|
53 |
+
st.write(f"Calories burned from pull-ups: {calories_from_pullups:.2f}")
|
54 |
+
else:
|
55 |
+
total_calories = calories_from_swimming + calories_from_pullups
|
56 |
+
st.write(f"Total calories burned: {total_calories:.2f}")
|
57 |
+
|
58 |
+
st.subheader("Muscle Groups Worked π¦Ύ")
|
59 |
+
if exercise_type == "Swim Jim πββοΈ":
|
60 |
+
st.write("Swimming works the back, shoulders, arms, and legs.")
|
61 |
+
elif exercise_type == "Ring King π":
|
62 |
+
st.write("Pull-ups work the back, biceps, and forearms.")
|
63 |
+
else:
|
64 |
+
st.write("Doing both exercises works almost all major muscle groups!")
|
65 |
+
|
66 |
+
st.subheader(f"Swim Style: {swim_style} π")
|
67 |
+
st.write("Various swim styles focus on different muscle groups.")
|
68 |
+
|
69 |
+
st.subheader(f"Ring Style: {ring_style} πͺ")
|
70 |
+
st.write("Different grip styles can emphasize different muscle groups.")
|