sanpdy commited on
Commit
d2ad9ac
·
1 Parent(s): 3d424a0

Fixed cpu mapping error

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -70,12 +70,9 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
70
  print(f"Using device: {device}")
71
 
72
  # Load YOLO detector
73
- #yolo = YOLO("/home/sankalp/flake_classification/models/best.pt")
74
- #yolo = YOLO("/home/sankalp/yolo_flake_detection/yolo11n_synthetic_runs/exp1/weights/best.pt")
75
- #yolo = YOLO("/home/sankalp/yolo_flake_detection/yolo_runs/yolo11l_flake_runs/weights/best.pt")
76
-
77
  yolo = YOLO("models/uark_detector_v3.pt")
78
- torch.load("models/flake_classifier_5layer.pth",map_location=torch.device("cpu"))
 
79
  ckpt_path = "models/flake_classifier_5layer.pth"
80
  ckpt = torch.load(ckpt_path, map_location=device)
81
 
@@ -139,4 +136,4 @@ demo = gr.Interface(
139
  )
140
 
141
  if __name__ == "__main__":
142
- demo.launch(share=True)
 
70
  print(f"Using device: {device}")
71
 
72
  # Load YOLO detector
 
 
 
 
73
  yolo = YOLO("models/uark_detector_v3.pt")
74
+
75
+ # Load classifier model checkpoint with proper device mapping
76
  ckpt_path = "models/flake_classifier_5layer.pth"
77
  ckpt = torch.load(ckpt_path, map_location=device)
78
 
 
136
  )
137
 
138
  if __name__ == "__main__":
139
+ demo.launch(share=True)