awacke1 commited on
Commit
6f41800
Β·
1 Parent(s): a99f0fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -1,8 +1,8 @@
1
  import streamlit as st
2
 
3
- # Revised Function to calculate calories burned during swimming based on swim style
4
- def calories_swim(time_hr, weight_kg, style_mets):
5
- return (time_hr * style_mets * 3.5 * weight_kg) / 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,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.0,
32
- "Backstroke πŸŠβ€β™‚οΈ": 9.0,
33
- "Breaststroke 🐸": 10.0,
34
- "Freestyle Light πŸ¦‹": 11.0,
35
- "Freestyle Vigorous πŸš€": 13.0,
36
- "Butterfly πŸ¦‹": 12.0,
37
- "Dog Paddle 🐢": 7.0
38
  }
39
 
40
  # Grip Styles with factors
@@ -57,8 +57,7 @@ grip_style = st.sidebar.selectbox(
57
  )
58
 
59
  # Calculation
60
- weight_kg = weight * 0.453592
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]}")