aje6 commited on
Commit
5c2da46
·
verified ·
1 Parent(s): 8826722

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -204,11 +204,15 @@ import gradio as gr
204
  import torch
205
  from PIL import Image
206
  import torchvision.transforms as T
207
- import ultralytics
208
 
209
  # Load your model
210
- model = torch.load("Model_IV.pt")
211
- model.eval()
 
 
 
 
212
 
213
  # Define preprocessing
214
  transform = T.Compose([
 
204
  import torch
205
  from PIL import Image
206
  import torchvision.transforms as T
207
+ from ultralytics import YOLO
208
 
209
  # Load your model
210
+ model = YOLO("Model_IV.pt")
211
+ # model = torch.load("Model_IV.pt")
212
+ # model.eval()
213
+ checkpoint = torch.load("model.pt")
214
+ model.load_state_dict(checkpoint) # Load the saved weights
215
+ model.eval() # Set the model to evaluation mode
216
 
217
  # Define preprocessing
218
  transform = T.Compose([