Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -64,9 +64,12 @@ with gr.Blocks() as demo:
|
|
64 |
# the image can be passed as a PIL or numpy
|
65 |
# create the final model for production
|
66 |
probability_model = tf.keras.Sequential([model, tf.keras.layers.Softmax()])
|
67 |
-
|
|
|
|
|
|
|
68 |
# Make a prediction using the model
|
69 |
-
prediction = probability_model.predict(
|
70 |
|
71 |
# Postprocess the prediction and return it
|
72 |
return np.argmax(predictions[0])
|
|
|
64 |
# the image can be passed as a PIL or numpy
|
65 |
# create the final model for production
|
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])
|