awacke1 commited on
Commit
d5769f9
Β·
1 Parent(s): 11fa257

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -4
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, speed_mph):
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.")