Update app.py
Browse files
app.py
CHANGED
@@ -75,14 +75,16 @@ model.summary()
|
|
75 |
|
76 |
|
77 |
|
78 |
-
|
79 |
-
img = img_to_array(img)
|
80 |
-
img = img.reshape(1, 1, 28, 28)
|
81 |
-
img = img.astype('float32')
|
82 |
-
img = img / 255.0
|
83 |
-
|
84 |
-
predict_x = model.predict(img)
|
85 |
-
classes_x = np.argmax(predict_x,axis=1)
|
86 |
-
|
87 |
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
|
77 |
|
78 |
+
if uploaded_file is not None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
+
img = load_img(uploaded_file, grayscale=True, target_size=(28, 28))
|
81 |
+
img = img_to_array(img)
|
82 |
+
img = img.reshape(1, 1, 28, 28)
|
83 |
+
img = img.astype('float32')
|
84 |
+
img = img / 255.0
|
85 |
+
|
86 |
+
predict_x = model.predict(img)
|
87 |
+
classes_x = np.argmax(predict_x,axis=1)
|
88 |
+
|
89 |
+
sign = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y']
|
90 |
+
st.write(sign[classes_x[0]])
|