lopesdri commited on
Commit
3906d80
·
1 Parent(s): 92d7df2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -6,9 +6,17 @@ from PIL import Image
6
  # Load your PyTorch model
7
  model = torch.load("model.pth",map_location=torch.device('cpu'))
8
 
 
 
 
 
 
 
 
 
9
  # Define the function for image classification
10
  def classify_image(image):
11
- image_tensor = ToTensor()(image).unsqueeze(0)
12
 
13
  # Perform inference using your PyTorch model
14
  with torch.no_grad():
 
6
  # Load your PyTorch model
7
  model = torch.load("model.pth",map_location=torch.device('cpu'))
8
 
9
+ classes = ['bom', 'ruim']
10
+
11
+ def preprocess(image):
12
+ image = image.resize((224, 224))
13
+ image_tensor = ToTensor()(image)
14
+ image_tensor = image_tensor.unsqueeze(0)
15
+ return image_tensor
16
+
17
  # Define the function for image classification
18
  def classify_image(image):
19
+ image_tensor = preprocess(image)
20
 
21
  # Perform inference using your PyTorch model
22
  with torch.no_grad():