awacke1 commited on
Commit
ea2481a
Β·
1 Parent(s): 8fb6c60

Create backup.app.py

Browse files
Files changed (1) hide show
  1. backup.app.py +85 -0
backup.app.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) / 10
6
+
7
+ # Function to calculate calories burned during pull-ups based on grip style
8
+ def calories_pullup(reps, weight, grip_style_factor):
9
+ return (reps * 5 * weight) / 150 * grip_style_factor
10
+
11
+ # Streamlit UI
12
+ st.title("Calories Burned Calculator πŸŠβ€β™‚οΈπŸ’ͺ")
13
+ st.sidebar.header("Input Parameters πŸ› οΈ")
14
+
15
+ # Swimming parameters
16
+ time_swim = st.sidebar.slider("Swimming Time (hours)", 0.0, 5.0, 2.0)
17
+ weight = st.sidebar.number_input("Your weight (lbs)", 100, 300, 175)
18
+
19
+ # Pull-Up parameters
20
+ reps = st.sidebar.slider("Number of Pull-Ups", 0, 500, 200)
21
+
22
+ # Choose Exercise Type
23
+ st.sidebar.subheader("Choose Exercise Type πŸ€Έβ€β™‚οΈ")
24
+ exercise_type = st.sidebar.selectbox(
25
+ "",
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
41
+ grip_styles = {
42
+ "Standard 🌟": 1,
43
+ "Mixed Grip ✨": 1.1,
44
+ "Wide Grip 🌠": 1.2
45
+ }
46
+
47
+ st.sidebar.subheader("Choose Swim Style 🌊")
48
+ swim_style = st.sidebar.selectbox(
49
+ "",
50
+ list(swim_styles.keys())
51
+ )
52
+
53
+ st.sidebar.subheader("Choose Ring Style πŸͺ")
54
+ grip_style = st.sidebar.selectbox(
55
+ "",
56
+ list(grip_styles.keys())
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
64
+ st.subheader(f"Calories Burned πŸ”₯")
65
+ if exercise_type == "Swim Jim πŸŠβ€β™‚οΈ":
66
+ st.write(f"Calories burned from swimming: {calories_from_swimming:.2f}")
67
+ elif exercise_type == "Ring King πŸ‘‘":
68
+ st.write(f"Calories burned from pull-ups: {calories_from_pullups:.2f}")
69
+ else:
70
+ total_calories = calories_from_swimming + calories_from_pullups
71
+ st.write(f"Total calories burned: {total_calories:.2f}")
72
+
73
+ st.subheader("Muscle Groups Worked 🦾")
74
+ if exercise_type == "Swim Jim πŸŠβ€β™‚οΈ":
75
+ st.write("Swimming works the back, shoulders, arms, and legs.")
76
+ elif exercise_type == "Ring King πŸ‘‘":
77
+ st.write("Pull-ups work the back, biceps, and forearms.")
78
+ else:
79
+ st.write("Doing both exercises works almost all major muscle groups!")
80
+
81
+ st.subheader(f"Swim Style: {swim_style} 🌊")
82
+ st.write(f"METS for chosen style: {swim_styles[swim_style]}")
83
+
84
+ st.subheader(f"Ring Style: {grip_style} πŸͺ")
85
+ st.write(f"Factor for chosen grip: {grip_styles[grip_style]}")