Gosula commited on
Commit
4679224
1 Parent(s): b72323a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -148,10 +148,10 @@ canvas_result = st_canvas(
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
 
 
148
  if canvas_result.image_data is not None:
149
  image = canvas_result.image_data
150
  image1 = image.copy()
151
+ image1 = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY).astype('float32') # Convert to float32
 
152
  image1 = cv2.resize(image1, (28, 28))
153
+ image1 /= 255.0 # Normalize the values to [0, 1]
154
+ # Convert to uint8 format (bytes)
155
  st.image(image1)
156
 
157