tarjomeh commited on
Commit
c112e1a
·
1 Parent(s): 052ae6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -44,9 +44,10 @@ def denormalize(x, mean=(0., 0., 0.), std=(1.0, 1.0, 1.0)):
44
 
45
  return x
46
 
47
- def resize_image(input_image_path, size):
48
- original_image = Image.open(input_image_path)
49
- width, height = original_image.size
 
50
  if max(width, height) > size:
51
  if width > height:
52
  ratio = width / size
@@ -56,10 +57,10 @@ def resize_image(input_image_path, size):
56
  ratio = height / size
57
  new_width = int(width / ratio)
58
  new_height = size
59
- resized_image = original_image.resize((new_width, new_height), Image.ANTIALIAS)
60
  return resized_image
61
  else:
62
- return original_image
63
 
64
 
65
  def nogan(input_img):
 
44
 
45
  return x
46
 
47
+ from PIL import Image
48
+
49
+ def resize_image(image, size):
50
+ width, height = image.size
51
  if max(width, height) > size:
52
  if width > height:
53
  ratio = width / size
 
57
  ratio = height / size
58
  new_width = int(width / ratio)
59
  new_height = size
60
+ resized_image = image.resize((new_width, new_height), Image.ANTIALIAS)
61
  return resized_image
62
  else:
63
+ return image
64
 
65
 
66
  def nogan(input_img):