njgroene commited on
Commit
928cd0e
1 Parent(s): fed756e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -14,13 +14,13 @@ from torch_mtcnn import show_bboxes
14
 
15
  def pipeline(img):
16
  bounding_boxes, landmarks = detect_faces(img)
17
- bb = [bounding_boxes[0,0], bounding_boxes[0,1], bounding_boxes[0,2], bounding_boxes[0,3]]
18
-
19
- if len(bb) == 0:
20
  raise Exception("Didn't face any faces, try another image!")
21
- if len(bb) > 1:
22
  raise Exception("Found more than one face, try a profile picture with only one person in it!")
23
-
 
 
24
  img_cropped = img.crop(bb)
25
 
26
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
 
14
 
15
  def pipeline(img):
16
  bounding_boxes, landmarks = detect_faces(img)
17
+ if len(bounding_boxes) == 0:
 
 
18
  raise Exception("Didn't face any faces, try another image!")
19
+ if len(bounding_boxes) > 1:
20
  raise Exception("Found more than one face, try a profile picture with only one person in it!")
21
+
22
+ bb = [bounding_boxes[0,0], bounding_boxes[0,1], bounding_boxes[0,2], bounding_boxes[0,3]]
23
+
24
  img_cropped = img.crop(bb)
25
 
26
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")