Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -39,11 +39,25 @@ def build_model(HIDDEN_UNITS=256, sequence_length=30, num_input_values=33*4, num
|
|
39 |
# Define the VideoProcessor class for real-time video processing
|
40 |
class VideoProcessor:
|
41 |
def __init__(self):
|
|
|
42 |
self.actions = np.array(['curl', 'press', 'squat'])
|
43 |
self.sequence_length = 30
|
44 |
self.colors = [(245,117,16), (117,245,16), (16,117,245)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
self.pose = mp_pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5)
|
46 |
-
|
47 |
|
48 |
def process_video(self, video_file):
|
49 |
# Get the filename from the file object
|
|
|
39 |
# Define the VideoProcessor class for real-time video processing
|
40 |
class VideoProcessor:
|
41 |
def __init__(self):
|
42 |
+
# Parameters
|
43 |
self.actions = np.array(['curl', 'press', 'squat'])
|
44 |
self.sequence_length = 30
|
45 |
self.colors = [(245,117,16), (117,245,16), (16,117,245)]
|
46 |
+
self.threshold = threshold3
|
47 |
+
|
48 |
+
# Detection variables
|
49 |
+
self.sequence = []
|
50 |
+
self.current_action = ''
|
51 |
+
|
52 |
+
# Rep counter logic variables
|
53 |
+
self.curl_counter = 0
|
54 |
+
self.press_counter = 0
|
55 |
+
self.squat_counter = 0
|
56 |
+
self.curl_stage = None
|
57 |
+
self.press_stage = None
|
58 |
+
self.squat_stage = None
|
59 |
self.pose = mp_pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5)
|
60 |
+
|
61 |
|
62 |
def process_video(self, video_file):
|
63 |
# Get the filename from the file object
|