Sobit commited on
Commit
6573de2
·
verified ·
1 Parent(s): 9f81d7f

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -29,20 +29,18 @@ def preprocess_image(image):
29
  # Resize the image
30
  image = cv2.resize(image, IMG_SIZE)
31
 
32
- # Convert the image to grayscale
33
- image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
34
 
35
  # Convert the image to float32 and normalize
36
  image = image.astype('float32') / 255.0
37
 
38
- # Add channel dimension
39
- image = np.expand_dims(image, axis=-1)
40
-
41
  # Add an extra dimension to simulate batch size of 1
42
  image = np.expand_dims(image, axis=0)
43
 
44
  return image
45
 
 
46
 
47
  def main():
48
  st.title("Character Recognition")
@@ -67,3 +65,4 @@ if __name__ == "__main__":
67
  main()
68
 
69
 
 
 
29
  # Resize the image
30
  image = cv2.resize(image, IMG_SIZE)
31
 
32
+ # Convert the image to RGB
33
+ image = cv2.cvtColor(image, cv2.COLOR_GRAY2RGB)
34
 
35
  # Convert the image to float32 and normalize
36
  image = image.astype('float32') / 255.0
37
 
 
 
 
38
  # Add an extra dimension to simulate batch size of 1
39
  image = np.expand_dims(image, axis=0)
40
 
41
  return image
42
 
43
+
44
 
45
  def main():
46
  st.title("Character Recognition")
 
65
  main()
66
 
67
 
68
+