Puyush commited on
Commit
b173fe0
·
verified ·
1 Parent(s): 3dcd15f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -100,11 +100,13 @@ image_width = 128
100
  image_height = 32
101
 
102
  def distortion_free_resize(image, img_size):
103
- w, h = img_size
104
- image = tf.image.resize(image, size=(h, w), preserve_aspect_ratio=True)
105
- image = tf.transpose(image, perm=[1,0,2])
106
- image = tf.image.flip_left_right(image)
107
- return image
 
 
108
 
109
  def decode_batch_predictions(input_image, img_size=(image_width, image_height)):
110
  img_byte_array = io.BytesIO()
 
100
  image_height = 32
101
 
102
  def distortion_free_resize(image, img_size):
103
+ w, h = img_size
104
+ image = tf.image.resize(image, size=(h, w), preserve_aspect_ratio=True)
105
+ image = tf.image.resize_with_pad(image, target_height=h, target_width=w)
106
+ image = tf.transpose(image, perm=[1, 0, 2])
107
+ image = tf.image.flip_left_right(image)
108
+ return image
109
+
110
 
111
  def decode_batch_predictions(input_image, img_size=(image_width, image_height)):
112
  img_byte_array = io.BytesIO()