Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
70 |
-
|
|
|
|
|
71 |
# Make a prediction using the model
|
72 |
-
prediction = probability_model.predict(
|
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])
|