binaychandra commited on
Commit
f641d1c
·
1 Parent(s): c6c785e

modify classify image fn

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -9,10 +9,10 @@ from models.convmodel import MNISTnet
9
  from pathlib import Path
10
 
11
  # Function to perform image classification
12
- def classify_image(image_path):
13
- imdata = np.asarray(Image.open(image_path))
14
  alltransforms = torchvision.transforms.Compose([torchvision.transforms.ToTensor()])
15
- tensor_image = alltransforms(imdata)
16
  # bring it to the shape model expects N, C, H, W
17
  #print(tensor_image.shape)
18
  model_input_tensor_image = tensor_image.unsqueeze(dim=0)
 
9
  from pathlib import Path
10
 
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)
18
  model_input_tensor_image = tensor_image.unsqueeze(dim=0)