Update app.py
Browse filesCreated new status box that is compatible with screen size
app.py
CHANGED
@@ -17,7 +17,7 @@ from sample_utils.turn import get_ice_servers
|
|
17 |
logger = logging.getLogger(__name__)
|
18 |
|
19 |
# Streamlit setup
|
20 |
-
st.set_page_config(page_title="AI Squat Detection", page_icon="🏋️"
|
21 |
st.markdown(
|
22 |
"""<style>
|
23 |
.status-box {
|
@@ -118,12 +118,10 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
118 |
if 80 < angleKneeL < 110 and stage == 'up':
|
119 |
stage = 'down'
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
cv2.rectangle(image, (0,0), (
|
124 |
-
cv2.rectangle(image, (0, 3), (
|
125 |
-
|
126 |
-
# REP data
|
127 |
|
128 |
cv2.putText(image, 'Left', (10, 22),
|
129 |
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
|
@@ -139,22 +137,22 @@ def video_frame_callback(frame: av.VideoFrame) -> av.VideoFrame:
|
|
139 |
cv2.putText(image, stage,
|
140 |
(170, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
|
141 |
|
142 |
-
#
|
143 |
|
144 |
|
145 |
-
|
146 |
-
|
147 |
|
148 |
-
|
149 |
-
|
150 |
|
151 |
-
#
|
152 |
|
153 |
-
|
154 |
-
|
155 |
|
156 |
-
|
157 |
-
|
158 |
mp_drawing.draw_landmarks(image, results.pose_landmarks, mp_pose.POSE_CONNECTIONS,mp_drawing.DrawingSpec(color=(255, 175, 0), thickness=2, circle_radius=2),mp_drawing.DrawingSpec(color=(0, 255, 200), thickness=2, circle_radius=2))
|
159 |
|
160 |
result_queue.put(detections)
|
|
|
17 |
logger = logging.getLogger(__name__)
|
18 |
|
19 |
# Streamlit setup
|
20 |
+
st.set_page_config(page_title="AI Squat Detection", page_icon="🏋️")
|
21 |
st.markdown(
|
22 |
"""<style>
|
23 |
.status-box {
|
|
|
118 |
if 80 < angleKneeL < 110 and stage == 'up':
|
119 |
stage = 'down'
|
120 |
|
121 |
+
# REP data
|
122 |
+
# Setup Status box
|
123 |
+
cv2.rectangle(image, (0,0), (275, 220), (127, 248, 236), -1)
|
124 |
+
cv2.rectangle(image, (0, 3), (273, 217), (12, 85, 61), -1)
|
|
|
|
|
125 |
|
126 |
cv2.putText(image, 'Left', (10, 22),
|
127 |
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
|
|
|
137 |
cv2.putText(image, stage,
|
138 |
(170, 70), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
|
139 |
|
140 |
+
# Hip angle
|
141 |
|
142 |
|
143 |
+
cv2.putText(image, 'HipL', (10, 150),
|
144 |
+
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
|
145 |
|
146 |
+
cv2.putText(image, str(int(angleHipL)),
|
147 |
+
(0, 200), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
|
148 |
|
149 |
+
# Knee angle
|
150 |
|
151 |
+
cv2.putText(image, 'Knee', (180, 150),
|
152 |
+
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (255, 255, 255), 2, cv2.LINE_AA)
|
153 |
|
154 |
+
cv2.putText(image, str(int(angleKneeL)),
|
155 |
+
(170, 200), cv2.FONT_HERSHEY_SIMPLEX, 1.7, (255, 255, 255), 2, cv2.LINE_AA)
|
156 |
mp_drawing.draw_landmarks(image, results.pose_landmarks, mp_pose.POSE_CONNECTIONS,mp_drawing.DrawingSpec(color=(255, 175, 0), thickness=2, circle_radius=2),mp_drawing.DrawingSpec(color=(0, 255, 200), thickness=2, circle_radius=2))
|
157 |
|
158 |
result_queue.put(detections)
|