Spaces:
Sleeping
Sleeping
Commit
·
f641d1c
1
Parent(s):
c6c785e
modify classify image fn
Browse files
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(
|
| 13 |
-
imdata = np.asarray(Image.open(image_path))
|
| 14 |
alltransforms = torchvision.transforms.Compose([torchvision.transforms.ToTensor()])
|
| 15 |
-
tensor_image = alltransforms(
|
| 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)
|