Kolpitor commited on
Commit
0a81201
·
1 Parent(s): e6c4a8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -75,14 +75,16 @@ model.summary()
75
 
76
 
77
 
78
- img = load_img(uploaded_file, grayscale=True, target_size=(28, 28))
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
- st.write(classes_x[0])
 
 
 
 
 
 
 
 
 
 
 
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]])