mralamdari commited on
Commit
84cfa36
·
1 Parent(s): ddde82a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -27,8 +27,10 @@ model = tf.keras.models.load_model('my_model_1.h5', compile=False)
27
 
28
 
29
  def classify_image(image):
30
- image = np.array(image['composite'])[:, :, 3] * 255
31
- image = image[..., np.newaxis]
 
 
32
  image_tensor = tf.convert_to_tensor(image)
33
  image_tensor = tf.image.resize(image_tensor, (28, 28)),
34
  image_tensor = tf.cast(image_tensor, tf.float32)
 
27
 
28
 
29
  def classify_image(image):
30
+ if len(np.array(image).shape) == 3:
31
+ image = tf.image.rgb_to_grayscale(image)
32
+ # image = np.array(image['composite'])[:, :, 3] * 255
33
+ # image = image[..., np.newaxis]
34
  image_tensor = tf.convert_to_tensor(image)
35
  image_tensor = tf.image.resize(image_tensor, (28, 28)),
36
  image_tensor = tf.cast(image_tensor, tf.float32)