Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
#
|
4 |
-
def calories_swim(time_hr,
|
5 |
-
return (time_hr * style_mets * 3.5 *
|
6 |
|
7 |
# Function to calculate calories burned during pull-ups based on grip style
|
8 |
def calories_pullup(reps, weight, grip_style_factor):
|
@@ -26,15 +26,15 @@ exercise_type = st.sidebar.selectbox(
|
|
26 |
["Swim Jim πββοΈ", "Ring King π", "Both Boost π"]
|
27 |
)
|
28 |
|
29 |
-
# Revised Swim Styles with METs
|
30 |
swim_styles = {
|
31 |
-
"Treading Water π": 6
|
32 |
-
"Backstroke πββοΈ": 9
|
33 |
-
"Breaststroke πΈ": 10
|
34 |
-
"Freestyle Light π¦": 11
|
35 |
-
"Freestyle Vigorous π":
|
36 |
-
"Butterfly π¦":
|
37 |
-
"Dog Paddle πΆ": 7
|
38 |
}
|
39 |
|
40 |
# Grip Styles with factors
|
@@ -57,8 +57,7 @@ grip_style = st.sidebar.selectbox(
|
|
57 |
)
|
58 |
|
59 |
# Calculation
|
60 |
-
|
61 |
-
calories_from_swimming = calories_swim(time_swim, weight_kg, swim_styles[swim_style])
|
62 |
calories_from_pullups = calories_pullup(reps, weight, grip_styles[grip_style])
|
63 |
|
64 |
# Display Results
|
@@ -84,4 +83,3 @@ st.write(f"METS for chosen style: {swim_styles[swim_style]}")
|
|
84 |
|
85 |
st.subheader(f"Ring Style: {grip_style} πͺ")
|
86 |
st.write(f"Factor for chosen grip: {grip_styles[grip_style]}")
|
87 |
-
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# Function to calculate calories burned during swimming based on swim style, now in pounds
|
4 |
+
def calories_swim(time_hr, weight_lb, style_mets):
|
5 |
+
return (time_hr * style_mets * 3.5 * weight_lb) / 200
|
6 |
|
7 |
# Function to calculate calories burned during pull-ups based on grip style
|
8 |
def calories_pullup(reps, weight, grip_style_factor):
|
|
|
26 |
["Swim Jim πββοΈ", "Ring King π", "Both Boost π"]
|
27 |
)
|
28 |
|
29 |
+
# Revised Swim Styles with METs to meet your requirement
|
30 |
swim_styles = {
|
31 |
+
"Treading Water π": 6,
|
32 |
+
"Backstroke πββοΈ": 9,
|
33 |
+
"Breaststroke πΈ": 10,
|
34 |
+
"Freestyle Light π¦": 11,
|
35 |
+
"Freestyle Vigorous π": 14.3,
|
36 |
+
"Butterfly π¦": 14.3,
|
37 |
+
"Dog Paddle πΆ": 7
|
38 |
}
|
39 |
|
40 |
# Grip Styles with factors
|
|
|
57 |
)
|
58 |
|
59 |
# Calculation
|
60 |
+
calories_from_swimming = calories_swim(time_swim, weight, swim_styles[swim_style])
|
|
|
61 |
calories_from_pullups = calories_pullup(reps, weight, grip_styles[grip_style])
|
62 |
|
63 |
# Display Results
|
|
|
83 |
|
84 |
st.subheader(f"Ring Style: {grip_style} πͺ")
|
85 |
st.write(f"Factor for chosen grip: {grip_styles[grip_style]}")
|
|