Spaces:
Sleeping
Sleeping
Update3
Browse files
app.py
CHANGED
@@ -1,65 +1,52 @@
|
|
1 |
-
# Consolidated Streamlit App
|
2 |
-
import streamlit as st
|
3 |
-
import subprocess
|
4 |
-
|
5 |
-
# Title and introduction
|
6 |
-
st.title("Muscle Memory")
|
7 |
-
|
8 |
-
import av
|
9 |
-
from streamlit_webrtc import webrtc_streamer, VideoProcessorBase
|
10 |
-
|
11 |
-
class VideoProcessor(VideoProcessorBase):
|
12 |
-
def recv(self, frame):
|
13 |
-
image = frame.to_ndarray(format="bgr24")
|
14 |
-
# Perform OpenCV processing here
|
15 |
-
return av.VideoFrame.from_ndarray(image, format="bgr24")
|
16 |
-
|
17 |
-
st.header("Webcam Feed")
|
18 |
-
webrtc_streamer(key="example", video_processor_factory=VideoProcessor)
|
19 |
-
|
20 |
-
st.markdown("""
|
21 |
-
Welcome to the **Workout Tracker App**!
|
22 |
-
Select your desired workout below, and the app will guide you through the exercise with real-time feedback.
|
23 |
-
""")
|
24 |
-
|
25 |
-
# Workout options
|
26 |
-
st.header("Choose Your Workout")
|
27 |
-
workout_option = st.selectbox(
|
28 |
-
"Available Workouts:",
|
29 |
-
["Bicep Curl", "Lateral Raise", "Shoulder Press"]
|
30 |
-
)
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
st.error(f"An error occurred while running {workout_option}. Please try again.")
|
51 |
-
except FileNotFoundError:
|
52 |
-
st.error(f"Workout script {selected_script} not found! Ensure the file exists in the same directory.")
|
53 |
|
54 |
-
#
|
55 |
-
st.
|
56 |
-
|
57 |
-
**Note**: Close the workout window or press "q" in the camera feed to stop the workout.
|
58 |
-
""")
|
59 |
|
|
|
|
|
60 |
|
61 |
-
#
|
62 |
-
|
|
|
|
|
|
|
|
|
63 |
import mediapipe as mp
|
64 |
import numpy as np
|
65 |
import time
|
@@ -270,9 +257,10 @@ def main():
|
|
270 |
if __name__ == "__main__":
|
271 |
main()
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
|
|
276 |
import mediapipe as mp
|
277 |
import numpy as np
|
278 |
import time
|
@@ -548,9 +536,10 @@ def main():
|
|
548 |
if __name__ == "__main__":
|
549 |
main()
|
550 |
|
551 |
-
|
552 |
-
|
553 |
-
|
|
|
554 |
import mediapipe as mp
|
555 |
import numpy as np
|
556 |
import time
|
@@ -731,3 +720,8 @@ if __name__ == "__main__":
|
|
731 |
main()
|
732 |
|
733 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
+
import streamlit as st
|
3 |
+
import cv2
|
4 |
+
import mediapipe as mp
|
5 |
+
import numpy as np
|
6 |
+
import time
|
7 |
+
from sklearn.ensemble import IsolationForest
|
8 |
|
9 |
+
# Streamlit configuration
|
10 |
+
st.set_page_config(page_title="Workout Tracker", page_icon="💪", layout="centered")
|
11 |
+
|
12 |
+
# Custom CSS for styling
|
13 |
+
st.markdown(
|
14 |
+
'''
|
15 |
+
<style>
|
16 |
+
body {
|
17 |
+
background-color: #001f3f;
|
18 |
+
color: #7FDBFF;
|
19 |
+
font-family: Arial, sans-serif;
|
20 |
+
}
|
21 |
+
.stButton > button {
|
22 |
+
background-color: #0074D9;
|
23 |
+
color: white;
|
24 |
+
border-radius: 5px;
|
25 |
+
padding: 10px 20px;
|
26 |
+
font-size: 18px;
|
27 |
}
|
28 |
+
.stButton > button:hover {
|
29 |
+
background-color: #7FDBFF;
|
30 |
+
color: #001f3f;
|
31 |
+
}
|
32 |
+
</style>
|
33 |
+
''',
|
34 |
+
unsafe_allow_html=True
|
35 |
+
)
|
|
|
|
|
|
|
36 |
|
37 |
+
# Title and Introduction
|
38 |
+
st.title("Workout Tracker")
|
39 |
+
st.markdown("Welcome to the **Workout Tracker App**! Select your desired workout below and receive real-time feedback as you exercise.")
|
|
|
|
|
40 |
|
41 |
+
# Workout Selection
|
42 |
+
workout_option = st.radio("Select Your Workout:", ["Bicep Curl", "Lateral Raise", "Shoulder Press"])
|
43 |
|
44 |
+
# Start Button
|
45 |
+
if st.button("Start Workout"):
|
46 |
+
if workout_option == "Bicep Curl":
|
47 |
+
st.write("Launching Bicep Curl Tracker...")
|
48 |
+
# Bicep workout code
|
49 |
+
import cv2
|
50 |
import mediapipe as mp
|
51 |
import numpy as np
|
52 |
import time
|
|
|
257 |
if __name__ == "__main__":
|
258 |
main()
|
259 |
|
260 |
+
elif workout_option == "Lateral Raise":
|
261 |
+
st.write("Launching Lateral Raise Tracker...")
|
262 |
+
# Lateral raise workout code
|
263 |
+
import cv2
|
264 |
import mediapipe as mp
|
265 |
import numpy as np
|
266 |
import time
|
|
|
536 |
if __name__ == "__main__":
|
537 |
main()
|
538 |
|
539 |
+
elif workout_option == "Shoulder Press":
|
540 |
+
st.write("Launching Shoulder Press Tracker...")
|
541 |
+
# Shoulder press workout code
|
542 |
+
import cv2
|
543 |
import mediapipe as mp
|
544 |
import numpy as np
|
545 |
import time
|
|
|
720 |
main()
|
721 |
|
722 |
|
723 |
+
# Footer
|
724 |
+
st.markdown("---")
|
725 |
+
st.markdown("**Note**: Close the workout window or press 'q' in the camera feed to stop the workout.")
|
726 |
+
|
727 |
+
|