File size: 2,784 Bytes
11fa257
 
 
7b6e912
 
 
11fa257
 
7b6e912
 
 
11fa257
 
 
 
d5769f9
11fa257
 
d5769f9
 
 
 
7b6e912
d5769f9
 
 
 
 
 
 
7b6e912
 
 
 
 
 
 
 
 
 
 
 
 
d5769f9
 
 
7b6e912
d5769f9
 
 
 
 
7b6e912
d5769f9
 
 
 
7b6e912
 
d5769f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import streamlit as st

# Function to calculate calories burned during swimming
def calories_swim(time_hr, weight_kg, style_factor):
    METS = 10  # Base Metabolic Equivalent for swimming
    return (time_hr * (METS * style_factor) * 3.5 * weight_kg) / 200

# Function to calculate calories burned during pull-ups
def calories_pullup(weight, reps, style_factor):
    # Lifting full body weight per pull-up, adjusted by style
    calories_per_pullup = weight * style_factor / 350
    return calories_per_pullup * reps

# Streamlit UI
st.title("Calories Burned Calculator πŸŠβ€β™‚οΈπŸ’ͺ")
st.sidebar.header("Input Parameters πŸ› οΈ")

# Swimming parameters
time_swim = st.sidebar.slider("Swimming Time (hours)", 0.0, 5.0, 2.0)
weight = st.sidebar.number_input("Your weight (lbs)", 100, 300, 175)

# Ring Exercise parameters
reps = st.sidebar.slider("Number of Pull-Ups", 0, 500, 200)

st.sidebar.subheader("Choose Exercise Type πŸ€Έβ€β™‚οΈ")
exercise_type = st.sidebar.selectbox(
    "",
    ["Swim Jim πŸŠβ€β™‚οΈ", "Ring King πŸ‘‘", "Both Boost πŸš€"]
)

# Style factor adjustments
swim_style_factors = {
    "Frog Kick 🐸": 1.0,
    "Dolphin Kick 🐬": 1.1,
    "Butterfly πŸ¦‹": 1.2
}

ring_style_factors = {
    "Standard 🌟": 1.0,
    "Mixed Grip ✨": 1.1,
    "Wide Grip 🌠": 1.2
}

st.sidebar.subheader("Choose Swim Style 🌊")
swim_style = st.sidebar.selectbox(
    "",
    list(swim_style_factors.keys())
)

st.sidebar.subheader("Choose Ring Style πŸͺ")
ring_style = st.sidebar.selectbox(
    "",
    list(ring_style_factors.keys())
)

# Calculation
weight_kg = weight * 0.453592
calories_from_swimming = calories_swim(time_swim, weight_kg, swim_style_factors[swim_style])
calories_from_pullups = calories_pullup(weight, reps, ring_style_factors[ring_style])

# Display
st.subheader(f"Calories Burned πŸ”₯")
if exercise_type == "Swim Jim πŸŠβ€β™‚οΈ":
    st.write(f"Calories burned from swimming: {calories_from_swimming:.2f}")
elif exercise_type == "Ring King πŸ‘‘":
    st.write(f"Calories burned from pull-ups: {calories_from_pullups:.2f}")
else:
    total_calories = calories_from_swimming + calories_from_pullups
    st.write(f"Total calories burned: {total_calories:.2f}")

st.subheader("Muscle Groups Worked 🦾")
if exercise_type == "Swim Jim πŸŠβ€β™‚οΈ":
    st.write("Swimming works the back, shoulders, arms, and legs.")
elif exercise_type == "Ring King πŸ‘‘":
    st.write("Pull-ups work the back, biceps, and forearms.")
else:
    st.write("Doing both exercises works almost all major muscle groups!")

st.subheader(f"Swim Style: {swim_style} 🌊")
st.write("Various swim styles focus on different muscle groups.")

st.subheader(f"Ring Style: {ring_style} πŸͺ")
st.write("Different grip styles can emphasize different muscle groups.")