ehsanhon commited on
Commit
584a667
·
verified ·
1 Parent(s): 604aae9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -191,13 +191,11 @@ def calculate_and_display_angles(image_path, return_angles=False):
191
  mp_pose = mp.solutions.pose
192
  pose = mp_pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5)
193
 
194
- image = cv2.imread(image_path)
 
 
195
  image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
196
 
197
- # pil_image = Image.open(image).convert('RGB') # PIL image
198
- # image_np = np.array(pil_image) # Convert to NumPy array
199
- # image_rgb = cv2.cvtColor(image_np, cv2.COLOR_RGB2BGR)
200
-
201
  # Get pose landmarks
202
  results = pose.process(image_rgb)
203
 
 
191
  mp_pose = mp.solutions.pose
192
  pose = mp_pose.Pose(min_detection_confidence=0.5, min_tracking_confidence=0.5)
193
 
194
+ # image = cv2.imread(image_path)
195
+ file_bytes = np.asarray(bytearray(image_path.read()), dtype=np.uint8)
196
+ image = cv2.imdecode(file_bytes, cv2.IMREAD_COLOR)
197
  image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
198
 
 
 
 
 
199
  # Get pose landmarks
200
  results = pose.process(image_rgb)
201