Update app.py
Browse files
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 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
| 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 =
|
| 60 |
return resized_image
|
| 61 |
else:
|
| 62 |
-
return
|
| 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):
|