beykun18 commited on
Commit
c568917
1 Parent(s): 9f2a335

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -42,13 +42,13 @@ def predict(im1, im2):
42
  if results2.multi_face_landmarks:
43
  for face_landmarks in results2.multi_face_landmarks:
44
  # get location of face detected
45
- top_x = int(face_landmarks.landmark[234].x * img2_w)
46
- top_y = int(face_landmarks.landmark[10].y * img2_h)
47
- bottom_x = int(face_landmarks.landmark[454].x * img2_w)
48
- bottom_y = int(face_landmarks.landmark[152].y * img2_h)
49
 
50
  face2 = im2[top_y:bottom_y, top_x:bottom_x]
51
- cv2.rectangle(im2, (top_x, top_y), (bottom_x, bottom_y), (0, 255, 0), 2)
52
 
53
  # Convert the tensor back to a PIL Image
54
  face1 = transforms.ToPILImage()(face1)
 
42
  if results2.multi_face_landmarks:
43
  for face_landmarks in results2.multi_face_landmarks:
44
  # get location of face detected
45
+ top_x2 = int(face_landmarks.landmark[234].x * img2_w)
46
+ top_y2 = int(face_landmarks.landmark[10].y * img2_h)
47
+ bottom_x2 = int(face_landmarks.landmark[454].x * img2_w)
48
+ bottom_y2 = int(face_landmarks.landmark[152].y * img2_h)
49
 
50
  face2 = im2[top_y:bottom_y, top_x:bottom_x]
51
+ cv2.rectangle(im2, (top_x2, top_y2), (bottom_x2, bottom_y2), (0, 255, 0), 2)
52
 
53
  # Convert the tensor back to a PIL Image
54
  face1 = transforms.ToPILImage()(face1)