Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
208 |
|
209 |
# Load your model
|
210 |
-
model =
|
211 |
-
model.
|
|
|
|
|
|
|
|
|
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([
|