rezaenayati commited on
Commit
7410ec2
·
verified ·
1 Parent(s): 7892a17

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
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)