Spaces:
Sleeping
Sleeping
Jeet Paul
commited on
Commit
·
f111fb5
1
Parent(s):
d2a1f67
Update app.py
Browse files
app.py
CHANGED
@@ -37,10 +37,12 @@ def predict_digit(img):
|
|
37 |
W1, b1, W2, b2 = params["W1"], params["b1"], params["W2"], params["b2"]
|
38 |
|
39 |
# Convert the sketchpad drawing to grayscale and resize it to (28, 28)
|
40 |
-
img_pil = Image.fromarray(np.uint8(img * 255)).convert("L")
|
41 |
|
|
|
|
|
42 |
# Convert the image to a NumPy array and normalize it
|
43 |
-
X = np.array(
|
44 |
|
45 |
# Get the prediction
|
46 |
prediction = make_predictions(X, W1, b1, W2, b2)
|
|
|
37 |
W1, b1, W2, b2 = params["W1"], params["b1"], params["W2"], params["b2"]
|
38 |
|
39 |
# Convert the sketchpad drawing to grayscale and resize it to (28, 28)
|
40 |
+
img_pil = Image.fromarray(np.uint8(img * 255)).convert("L")
|
41 |
|
42 |
+
res=img_pil.resize((28, 28))
|
43 |
+
|
44 |
# Convert the image to a NumPy array and normalize it
|
45 |
+
X = np.array(res).reshape((784, 1)) / 255.
|
46 |
|
47 |
# Get the prediction
|
48 |
prediction = make_predictions(X, W1, b1, W2, b2)
|