Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ model = tf.keras.models.load_model(
|
|
23 |
|
24 |
def load_and_prep_imgg(filename, img_shape=224, scale=True):
|
25 |
img = tf.io.read_file(filename)
|
26 |
-
img = tf.io.decode_image(img)
|
27 |
img = tf.image.resize(img, size=[img_shape, img_shape])
|
28 |
if scale:
|
29 |
return img / 255
|
@@ -35,7 +35,7 @@ def predict(img) -> Tuple[Dict,float] :
|
|
35 |
start_time = timer()
|
36 |
|
37 |
image = load_and_prep_imgg(img)
|
38 |
-
image = Image.open(image)
|
39 |
|
40 |
pred_img = model.predict(tf.expand_dims(image, axis=0))
|
41 |
pred_class = class_names[pred_img.argmax()]
|
|
|
23 |
|
24 |
def load_and_prep_imgg(filename, img_shape=224, scale=True):
|
25 |
img = tf.io.read_file(filename)
|
26 |
+
img = tf.io.decode_image(img, channels=3)
|
27 |
img = tf.image.resize(img, size=[img_shape, img_shape])
|
28 |
if scale:
|
29 |
return img / 255
|
|
|
35 |
start_time = timer()
|
36 |
|
37 |
image = load_and_prep_imgg(img)
|
38 |
+
#image = Image.open(image)
|
39 |
|
40 |
pred_img = model.predict(tf.expand_dims(image, axis=0))
|
41 |
pred_class = class_names[pred_img.argmax()]
|