dhhd255 commited on
Commit
f528ede
·
1 Parent(s): b3fc59e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import streamlit as st
2
  import torch
3
  from torchvision import transforms
 
4
  from huggingface_hub import HfFileSystem
5
  from PIL import Image
6
 
@@ -15,7 +16,8 @@ with open('best_model.pth', 'wb') as f:
15
  f.write(model_content)
16
 
17
  # Load your custom model onto the CPU
18
- model = torch.hub.load('ultralytics/yolov5', 'custom', path='best_model.pth', force_reload=True)
 
19
  model.eval()
20
 
21
  # Define a function that takes an image as input and uses the model for inference
 
1
  import streamlit as st
2
  import torch
3
  from torchvision import transforms
4
+ from efficientnet_pytorch import EfficientNet
5
  from huggingface_hub import HfFileSystem
6
  from PIL import Image
7
 
 
16
  f.write(model_content)
17
 
18
  # Load your custom model onto the CPU
19
+ model = EfficientNet.from_pretrained('efficientnet-b3')
20
+ model.load_state_dict(torch.load('best_model.pth', map_location=torch.device('cpu')))
21
  model.eval()
22
 
23
  # Define a function that takes an image as input and uses the model for inference