erfanasgari21 commited on
Commit
b7cc724
·
verified ·
1 Parent(s): 905c5c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -17,13 +17,13 @@ def predict(image):
17
  width, height = image.size
18
  ratio = width / height
19
  if(width > height):
20
- height = int(256 / ratio)
21
- width = 256
22
  else:
23
- width = int(256 * ratio)
24
- height = 256
25
 
26
- resized_image = TF.resize(image, (height, width))
27
 
28
  padded_image = Image.new("RGB", (256, 256))
29
  padded_image.paste(resized_image, (0, 0))
 
17
  width, height = image.size
18
  ratio = width / height
19
  if(width > height):
20
+ new_height = int(256 / ratio)
21
+ new_width = 256
22
  else:
23
+ new_width = int(256 * ratio)
24
+ new_height = 256
25
 
26
+ resized_image = TF.resize(image, (new_height, new_width))
27
 
28
  padded_image = Image.new("RGB", (256, 256))
29
  padded_image.paste(resized_image, (0, 0))