SakibRumu
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -7,13 +7,17 @@ from PIL import Image
|
|
7 |
import sys
|
8 |
import os
|
9 |
|
10 |
-
import
|
11 |
-
|
|
|
|
|
12 |
|
13 |
-
|
|
|
14 |
|
15 |
-
|
16 |
-
|
|
|
17 |
|
18 |
# Frame processing function
|
19 |
def process_frame(frame):
|
|
|
7 |
import sys
|
8 |
import os
|
9 |
|
10 |
+
import torch
|
11 |
+
import torch.serialization
|
12 |
+
from ultralytics import YOLO
|
13 |
+
from ultralytics.nn.tasks import YOLOv10DetectionModel
|
14 |
|
15 |
+
# Register the custom class for safe loading
|
16 |
+
torch.serialization.add_safe_globals({'YOLOv10DetectionModel': YOLOv10DetectionModel})
|
17 |
|
18 |
+
# Load the model inside a safe context
|
19 |
+
with torch.serialization.safe_globals({'YOLOv10DetectionModel': YOLOv10DetectionModel}):
|
20 |
+
model = YOLO('/home/user/app/best.pt') # Load your YOLOv10 model
|
21 |
|
22 |
# Frame processing function
|
23 |
def process_frame(frame):
|