Object Detection
YOLOv10
computer-vision
pypi
kadirnar commited on
Commit
0e86c62
1 Parent(s): 5d73d36

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -1
README.md CHANGED
@@ -26,7 +26,26 @@ from ultralytics import YOLOv10
26
  import supervision as sv
27
  import cv2
28
 
29
- MODEL_PATH = 'yolov10n.pt'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  IMAGE_PATH = 'dog.jpeg'
31
 
32
  model = YOLOv10(MODEL_PATH)
 
26
  import supervision as sv
27
  import cv2
28
 
29
+ def attempt_download_from_hub(repo_id, hf_token=None):
30
+ # https://github.com/fcakyon/yolov5-pip/blob/main/yolov5/utils/downloads.py
31
+ from huggingface_hub import hf_hub_download, list_repo_files
32
+ from huggingface_hub.utils._errors import RepositoryNotFoundError
33
+ from huggingface_hub.utils._validators import HFValidationError
34
+ try:
35
+ repo_files = list_repo_files(repo_id=repo_id, repo_type='model', token=hf_token)
36
+ model_file = [f for f in repo_files if f.endswith('.pt')][0]
37
+ file = hf_hub_download(
38
+ repo_id=repo_id,
39
+ filename=model_file,
40
+ repo_type='model',
41
+ token=hf_token,
42
+ )
43
+ return file
44
+ except (RepositoryNotFoundError, HFValidationError):
45
+ return None
46
+
47
+
48
+ MODEL_PATH = attempt_download_from_hub("kadirnar/yolov10x", hf_token="hf_token")
49
  IMAGE_PATH = 'dog.jpeg'
50
 
51
  model = YOLOv10(MODEL_PATH)