AI-RESEARCHER-2024 commited on
Commit
7209b2b
·
verified ·
1 Parent(s): 0d33bd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -21,7 +21,7 @@ mnist_examples = [[cv2.resize(x_test[i], DIMS)] for i in range(10)]
21
  # Function to preprocess the image
22
  def preprocess_image(image):
23
  if isinstance(image, Image.Image):
24
- image = np.array(image)
25
  image = cv2.resize(image, (28, 28)) # Resize to 28x28 for model input
26
  image = image / 255.0
27
  image = image.reshape(1, 28, 28, 1)
 
21
  # Function to preprocess the image
22
  def preprocess_image(image):
23
  if isinstance(image, Image.Image):
24
+ image = np.array(image.convert('L')) # Convert to grayscale
25
  image = cv2.resize(image, (28, 28)) # Resize to 28x28 for model input
26
  image = image / 255.0
27
  image = image.reshape(1, 28, 28, 1)