Sakibrumu commited on
Commit
d85faf4
·
verified ·
1 Parent(s): 85fdb72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -12,23 +12,25 @@ from pathlib import Path
12
  import dill._dill
13
  import torch
14
  from torch.serialization import add_safe_globals, safe_globals
15
- from torch.nn import Sequential # 🔥 এই লাইনে Sequential কে allow করব
16
 
17
  # Yolov10 import path add
18
  sys.path.append(str(Path(__file__).resolve().parent / "yolov10"))
19
 
20
- # Import YOLOv10 detection model class
21
  from ultralytics.nn.tasks import YOLOv10DetectionModel
 
22
  from ultralytics import YOLO
23
 
24
  # Add trusted globals
25
- add_safe_globals([YOLOv10DetectionModel, dill._dill._load_type, Sequential])
26
 
27
  # Safely load the model
28
- with safe_globals([YOLOv10DetectionModel, dill._dill._load_type, Sequential]):
29
  model = YOLO('/home/user/app/best.pt')
30
 
31
 
 
32
 
33
  # Frame processing function
34
  def process_frame(frame):
 
12
  import dill._dill
13
  import torch
14
  from torch.serialization import add_safe_globals, safe_globals
15
+ from torch.nn import Sequential
16
 
17
  # Yolov10 import path add
18
  sys.path.append(str(Path(__file__).resolve().parent / "yolov10"))
19
 
20
+ # Import YOLOv10 classes
21
  from ultralytics.nn.tasks import YOLOv10DetectionModel
22
+ from ultralytics.nn.modules.conv import Conv # ✅ নতুনটা
23
  from ultralytics import YOLO
24
 
25
  # Add trusted globals
26
+ add_safe_globals([YOLOv10DetectionModel, dill._dill._load_type, Sequential, Conv])
27
 
28
  # Safely load the model
29
+ with safe_globals([YOLOv10DetectionModel, dill._dill._load_type, Sequential, Conv]):
30
  model = YOLO('/home/user/app/best.pt')
31
 
32
 
33
+
34
 
35
  # Frame processing function
36
  def process_frame(frame):