Gosula commited on
Commit
b72323a
1 Parent(s): 4028b98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -146,15 +146,15 @@ canvas_result = st_canvas(
146
 
147
  # Do something interesting with the image data and paths
148
  if canvas_result.image_data is not None:
149
- #st.image(canvas_result.image_data)
150
  image = canvas_result.image_data
151
  image1 = image.copy()
152
  image1 = image1.astype('float32')
153
- image1 = cv2.cvtColor(image1,cv2.COLOR_BGR2GRAY)
154
- image1 = cv2.resize(image1,(28,28))
155
- image1 = image1 / 255.0
156
  st.image(image1)
157
 
 
158
  image1.resize(1,1,28,28)
159
  st.title(np.argmax(cnn.predict(image1)))
160
  if canvas_result.json_data is not None:
 
146
 
147
  # Do something interesting with the image data and paths
148
  if canvas_result.image_data is not None:
 
149
  image = canvas_result.image_data
150
  image1 = image.copy()
151
  image1 = image1.astype('float32')
152
+ image1 = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
153
+ image1 = cv2.resize(image1, (28, 28))
154
+ image1 = (image1 * 255).astype('uint8') # Convert to uint8 format (bytes)
155
  st.image(image1)
156
 
157
+
158
  image1.resize(1,1,28,28)
159
  st.title(np.argmax(cnn.predict(image1)))
160
  if canvas_result.json_data is not None: