Spaces:
Build error
Build error
owaiskha9654
commited on
Commit
•
eaa6868
1
Parent(s):
d2ef392
Update app.py
Browse files
app.py
CHANGED
@@ -8,15 +8,9 @@ REPO_ID = "owaiskha9654/Yolov7_Custom_Object_Detection"
|
|
8 |
FILENAME = "best.pt"
|
9 |
print(os.getcwd())
|
10 |
yolov7_weights = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
|
|
|
|
|
11 |
|
12 |
-
try:
|
13 |
-
model = torch.hub.load('jinfagang/yolov7', 'custom', path=yolov7_weights, force_reload=True) # local repo
|
14 |
-
except:
|
15 |
-
import zipfile
|
16 |
-
l_files = os.listdir("./.cache/torch/hub")
|
17 |
-
print(l_files)
|
18 |
-
with zipfile.ZipFile("./.cache/torch/hub/main.zip","r") as zip_ref:
|
19 |
-
zip_ref.extractall("./.cache/torch/hub/jinfagang_yolov7_main/")
|
20 |
def object_detection(im, size=416):
|
21 |
results = model(im) # inference
|
22 |
#results.print() # print results to screen
|
|
|
8 |
FILENAME = "best.pt"
|
9 |
print(os.getcwd())
|
10 |
yolov7_weights = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
|
11 |
+
model = torch.hub.load('jinfagang/yolov7', 'custom', path=yolov7_weights, force_reload=False) # local repo
|
12 |
+
print(l_files)
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
def object_detection(im, size=416):
|
15 |
results = model(im) # inference
|
16 |
#results.print() # print results to screen
|