binaychandra commited on
Commit
b3a91df
·
1 Parent(s): a864ac4

convert input image to grayscale

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -11,7 +11,9 @@ from pathlib import Path
11
  # Function to perform image classification
12
  def classify_image(img):
13
  #imdata = np.asarray(Image.open(image_path))
14
- alltransforms = torchvision.transforms.Compose([torchvision.transforms.ToTensor()])
 
 
15
  tensor_image = alltransforms(img)
16
  # bring it to the shape model expects N, C, H, W
17
  #print(tensor_image.shape)
 
11
  # Function to perform image classification
12
  def classify_image(img):
13
  #imdata = np.asarray(Image.open(image_path))
14
+ alltransforms = torchvision.transforms.Compose([
15
+ torchvision.transforms.Grayscale(),
16
+ torchvision.transforms.ToTensor()])
17
  tensor_image = alltransforms(img)
18
  # bring it to the shape model expects N, C, H, W
19
  #print(tensor_image.shape)