Update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,8 @@ def predict(image_array):
|
|
17 |
|
18 |
image = Image.fromarray(image_array.astype("uint8"), mode="L")
|
19 |
image = image.resize((28, 28))
|
|
|
|
|
20 |
image_array = np.array(image).astype("float32") / 255.0
|
21 |
image_array = image_array.reshape(1, 28, 28, 1)
|
22 |
logits = model.predict(image_array)
|
|
|
17 |
|
18 |
image = Image.fromarray(image_array.astype("uint8"), mode="L")
|
19 |
image = image.resize((28, 28))
|
20 |
+
image = image.point(lambda x: 0 if x < 128 else 255, 'L')
|
21 |
+
image = image.resize((28, 28))
|
22 |
image_array = np.array(image).astype("float32") / 255.0
|
23 |
image_array = image_array.reshape(1, 28, 28, 1)
|
24 |
logits = model.predict(image_array)
|