Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,13 +4,8 @@ import numpy as np
|
|
| 4 |
import streamlit as st
|
| 5 |
|
| 6 |
# Initialize MediaPipe Pose
|
| 7 |
-
# Initializing mediapipe pose class.
|
| 8 |
mp_pose = mp.solutions.pose
|
| 9 |
-
|
| 10 |
-
# Setting up the Pose function.
|
| 11 |
-
pose = mp_pose.Pose(static_image_mode=True, min_detection_confidence=0.3, model_complexity=2)
|
| 12 |
-
|
| 13 |
-
# Initializing mediapipe drawing class, useful for annotation.
|
| 14 |
mp_drawing = mp.solutions.drawing_utils
|
| 15 |
|
| 16 |
# Streamlit web interface
|
|
@@ -25,6 +20,7 @@ cap = cv2.VideoCapture(0)
|
|
| 25 |
while run:
|
| 26 |
ret, frame = cap.read()
|
| 27 |
if not ret:
|
|
|
|
| 28 |
break
|
| 29 |
|
| 30 |
# Convert the BGR image to RGB
|
|
@@ -45,3 +41,4 @@ while run:
|
|
| 45 |
|
| 46 |
cap.release()
|
| 47 |
cv2.destroyAllWindows()
|
|
|
|
|
|
| 4 |
import streamlit as st
|
| 5 |
|
| 6 |
# Initialize MediaPipe Pose
|
|
|
|
| 7 |
mp_pose = mp.solutions.pose
|
| 8 |
+
pose = mp_pose.Pose(static_image_mode=False, model_complexity=1, enable_segmentation=False, min_detection_confidence=0.5)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
mp_drawing = mp.solutions.drawing_utils
|
| 10 |
|
| 11 |
# Streamlit web interface
|
|
|
|
| 20 |
while run:
|
| 21 |
ret, frame = cap.read()
|
| 22 |
if not ret:
|
| 23 |
+
st.error("Failed to capture image from webcam")
|
| 24 |
break
|
| 25 |
|
| 26 |
# Convert the BGR image to RGB
|
|
|
|
| 41 |
|
| 42 |
cap.release()
|
| 43 |
cv2.destroyAllWindows()
|
| 44 |
+
|