|
import streamlit as st |
|
|
|
|
|
def calories_swim(time_hr, weight_kg): |
|
METS = 10 |
|
return (time_hr * METS * 3.5 * weight_kg) / 200 |
|
|
|
|
|
def calories_pullup(weight, reps): |
|
|
|
calories_per_pullup = (weight * 0.453592) * 2 / 2.20462 |
|
return calories_per_pullup * reps |
|
|
|
|
|
st.title("Calories Burned Calculator πββοΈπͺ") |
|
st.sidebar.header("Input 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) |
|
|
|
|
|
reps = st.sidebar.slider("Number of Pull-Ups", 0, 500, 400) |
|
|
|
st.sidebar.subheader("Choose Exercise Type π€ΈββοΈ") |
|
exercise_type = st.sidebar.selectbox( |
|
"", |
|
["Swim Jim πββοΈ", "Ring King π", "Both Boost π"] |
|
) |
|
|
|
st.sidebar.subheader("Choose Swim Style π") |
|
swim_style = st.sidebar.selectbox( |
|
"", |
|
["Frog Kick πΈ", "Dolphin Kick π¬", "Butterfly π¦"] |
|
) |
|
|
|
st.sidebar.subheader("Choose Ring Style πͺ") |
|
ring_style = st.sidebar.selectbox( |
|
"", |
|
["Standard π", "Mixed Grip β¨", "Wide Grip π "] |
|
) |
|
|
|
|
|
weight_kg = weight * 0.453592 |
|
calories_from_swimming = calories_swim(time_swim, weight_kg) |
|
calories_from_pullups = calories_pullup(weight, reps) |
|
|
|
|
|
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.") |
|
|