Xintao commited on
Commit
e836c0d
1 Parent(s): 7c69d8e
Files changed (1) hide show
  1. app.py +1 -8
app.py CHANGED
@@ -52,20 +52,13 @@ def inference(img):
52
  if h < 400:
53
  img = cv2.resize(img, (w * 2, h * 2), interpolation=cv2.INTER_LANCZOS4)
54
 
55
- if len(img.shape) == 3 and img.shape[2] == 4:
56
- img_mode = 'RGBA'
57
- else:
58
- img_mode = None
59
-
60
  try:
61
  _, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True)
62
  except RuntimeError as error:
63
  print('Error', error)
64
  print('If you encounter CUDA out of memory, try to set --tile with a smaller number.')
65
  else:
66
- extension = extension[1:]
67
- if img_mode == 'RGBA': # RGBA images should be saved in png format
68
- extension = 'png'
69
 
70
  return Image.fromarray(output)
71
 
 
52
  if h < 400:
53
  img = cv2.resize(img, (w * 2, h * 2), interpolation=cv2.INTER_LANCZOS4)
54
 
 
 
 
 
 
55
  try:
56
  _, _, output = face_enhancer.enhance(img, has_aligned=False, only_center_face=False, paste_back=True)
57
  except RuntimeError as error:
58
  print('Error', error)
59
  print('If you encounter CUDA out of memory, try to set --tile with a smaller number.')
60
  else:
61
+ extension = 'png'
 
 
62
 
63
  return Image.fromarray(output)
64