sparsh007 commited on
Commit
b37081f
·
verified ·
1 Parent(s): 84c957c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -4,10 +4,14 @@ from PIL import Image
4
  import os
5
  import zipfile
6
  import io
 
 
 
 
7
 
8
  # Load the YOLOv5 model (ensure the path is correct)
9
  model = torch.hub.load(
10
- 'ultralytics/yolov5', 'custom', path='yolov5/runs/train/exp/weights/best.pt'
11
  )
12
 
13
  # Global variables to store images and labels for carousel functionality
 
4
  import os
5
  import zipfile
6
  import io
7
+ import shutil
8
+
9
+ # Clear the torch hub cache to prevent any previous corrupted downloads
10
+ shutil.rmtree(torch.hub._get_torch_home(), ignore_errors=True)
11
 
12
  # Load the YOLOv5 model (ensure the path is correct)
13
  model = torch.hub.load(
14
+ 'ultralytics/yolov5', 'custom', path='yolov5/runs/train/exp/weights/best.pt', trust_repo=True
15
  )
16
 
17
  # Global variables to store images and labels for carousel functionality