Spaces:
Runtime error
Runtime error
app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,15 @@
|
|
1 |
import torch
|
|
|
2 |
from torch.serialization import add_safe_globals
|
3 |
from ultralytics.nn.tasks import DetectionModel
|
4 |
|
5 |
-
# --- FIX for PyTorch 2.6 ---
|
6 |
-
add_safe_globals([DetectionModel])
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
# Now safe to load the model
|
11 |
-
model = YOLO("yolov8n")
|
12 |
|
13 |
|
14 |
def track_objects(video_input):
|
|
|
1 |
import torch
|
2 |
+
from ultralytics import YOLO
|
3 |
from torch.serialization import add_safe_globals
|
4 |
from ultralytics.nn.tasks import DetectionModel
|
5 |
|
|
|
|
|
6 |
|
7 |
+
torch.serialization.add_safe_globals([torch.nn.modules.container.Sequential])
|
8 |
+
|
9 |
+
model = YOLO("yolov8n.pt")
|
10 |
+
|
11 |
+
# your other code continues...
|
12 |
|
|
|
|
|
13 |
|
14 |
|
15 |
def track_objects(video_input):
|