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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -120,7 +120,7 @@ cnn = NeuralNetClassifier(
120
  optimizer=torch.optim.Adam, # You can set the optimizer used during training
121
  device='cpu' # You can specify the device ('cpu' for CPU, 'cuda' for GPU, etc.)
122
  )
123
-
124
  stroke_width = st.sidebar.slider("Stroke width: ", 1, 35, 32)
125
  stroke_color = st.sidebar.color_picker("Stroke color hex: ")
126
  bg_color = st.sidebar.color_picker("Background color hex: ", "#eee")
@@ -149,9 +149,10 @@ 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('uint8')
153
  image1 = cv2.cvtColor(image1,cv2.COLOR_BGR2GRAY)
154
  image1 = cv2.resize(image1,(28,28))
 
155
  st.image(image1)
156
 
157
  image1.resize(1,1,28,28)
 
120
  optimizer=torch.optim.Adam, # You can set the optimizer used during training
121
  device='cpu' # You can specify the device ('cpu' for CPU, 'cuda' for GPU, etc.)
122
  )
123
+ cnn.fit(XCnn_train, y_train)
124
  stroke_width = st.sidebar.slider("Stroke width: ", 1, 35, 32)
125
  stroke_color = st.sidebar.color_picker("Stroke color hex: ")
126
  bg_color = st.sidebar.color_picker("Background color hex: ", "#eee")
 
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)