Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -130,11 +130,15 @@ def distortion_free_resize(image, img_size):
|
|
130 |
image = tf.image.flip_left_right(image)
|
131 |
return image
|
132 |
|
133 |
-
def
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
138 |
input_image = distortion_free_resize(input_image, img_size)
|
139 |
input_image = tf.image.convert_image_dtype(input_image, tf.float32)/255.0
|
140 |
|
|
|
130 |
image = tf.image.flip_left_right(image)
|
131 |
return image
|
132 |
|
133 |
+
def download_and_read_image(url):
|
134 |
+
img_path = tf.keras.utils.get_file(os.path.basename(url), origin=url)
|
135 |
+
img = tf.io.read_file(img_path)
|
136 |
+
return img, img_path
|
137 |
+
|
138 |
+
def decode_batch_predictions(img_url):
|
139 |
+
img, img_path = download_and_read_image(img_url)
|
140 |
+
img_size=(128, 32
|
141 |
+
input_image = tf.io.decode_png(img, channels=1)
|
142 |
input_image = distortion_free_resize(input_image, img_size)
|
143 |
input_image = tf.image.convert_image_dtype(input_image, tf.float32)/255.0
|
144 |
|