Doron Adler commited on
Commit
67fc694
1 Parent(s): e0da931

Also Exif transpose images without detected faces

Browse files
Files changed (2) hide show
  1. .gitignore +2 -0
  2. app.py +4 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ *.pyc
2
+ gradio_queue.db
app.py CHANGED
@@ -35,6 +35,10 @@ def find_aligned_face(image_in, size=256):
35
  def align_first_face(image_in, size=256):
36
  aligned_image, n_faces, quad = find_aligned_face(image_in,size=size)
37
  if n_faces == 0:
 
 
 
 
38
  image_in = image_in.resize((size, size))
39
  im_array = image_as_array(image_in)
40
  else:
 
35
  def align_first_face(image_in, size=256):
36
  aligned_image, n_faces, quad = find_aligned_face(image_in,size=size)
37
  if n_faces == 0:
38
+ try:
39
+ image_in = ImageOps.exif_transpose(image_in)
40
+ except:
41
+ print("exif problem, not rotating")
42
  image_in = image_in.resize((size, size))
43
  im_array = image_as_array(image_in)
44
  else: