hwberry2 commited on
Commit
c7e5ac7
·
1 Parent(s): c3d5e68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -66,10 +66,12 @@ with gr.Blocks() as demo:
66
  probability_model = tf.keras.Sequential([model, tf.keras.layers.Softmax()])
67
 
68
  # Normalize the pixel values
69
- img_normal = img / 255.0
70
- img_normal = img_normal.reshape((1, 28, 28))
 
 
71
  # Make a prediction using the model
72
- prediction = probability_model.predict(img_normal)
73
 
74
  # Postprocess the prediction and return it
75
  return np.argmax(predictions[0])
 
66
  probability_model = tf.keras.Sequential([model, tf.keras.layers.Softmax()])
67
 
68
  # Normalize the pixel values
69
+ # assuming image_array is your input image array of shape (552, 3)
70
+ resized_array = np.resize(img, (28, 28)) # resize the array to (28, 28)
71
+ input_array = np.expand_dims(resized_array, axis=0) # add an extra dimension to represent the batch size
72
+
73
  # Make a prediction using the model
74
+ prediction = probability_model.predict(img_array)
75
 
76
  # Postprocess the prediction and return it
77
  return np.argmax(predictions[0])