Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,11 +100,13 @@ image_width = 128
|
|
| 100 |
image_height = 32
|
| 101 |
|
| 102 |
def distortion_free_resize(image, img_size):
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
| 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()
|