dhhd255 commited on
Commit
acbd515
·
1 Parent(s): 36f8da9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -28,9 +28,10 @@ with open(custom_model_file, 'wb') as f:
28
  model = torch.load(efficientnet_model_file)
29
 
30
  # Load your custom model onto the CPU
31
- model.load_state_dict(torch.load(custom_model_file))
32
  model.eval()
33
 
 
34
  # Define a function that takes an image as input and uses the model for inference
35
  def image_classifier(image):
36
  # Preprocess the input image
 
28
  model = torch.load(efficientnet_model_file)
29
 
30
  # Load your custom model onto the CPU
31
+ model.load_state_dict(torch.load(custom_model_file, map_location=torch.device('cpu')))
32
  model.eval()
33
 
34
+
35
  # Define a function that takes an image as input and uses the model for inference
36
  def image_classifier(image):
37
  # Preprocess the input image