Prabhat51 commited on
Commit
72c5da0
·
verified ·
1 Parent(s): 59c285b

Update inference_utils.py

Browse files
Files changed (1) hide show
  1. inference_utils.py +14 -3
inference_utils.py CHANGED
@@ -7,11 +7,22 @@ from datetime import datetime
7
  from paddleocr import PaddleOCR
8
  from difflib import get_close_matches
9
 
 
 
 
 
 
10
  # Load models from Hugging Face
11
  def load_models():
12
- vehicle_detector = YOLO("https://huggingface.co/Prabhat51/number-plate-models/blob/main/veh_detect.pt")
13
- vehicle_classifier = YOLO("https://huggingface.co/Prabhat51/number-plate-models/blob/main/veh_class.pt")
14
- plate_detector = YOLO("https://huggingface.co/Prabhat51/number-plate-models/blob/main/plate_detect.pt")
 
 
 
 
 
 
15
  ocr_reader = PaddleOCR(use_angle_cls=True, lang='en')
16
  return vehicle_detector, vehicle_classifier, plate_detector, ocr_reader
17
 
 
7
  from paddleocr import PaddleOCR
8
  from difflib import get_close_matches
9
 
10
+ from huggingface_hub import hf_hub_download
11
+
12
+ # Download to local cache
13
+
14
+
15
  # Load models from Hugging Face
16
  def load_models():
17
+ # vehicle_detector = YOLO("https://huggingface.co/Prabhat51/number-plate-models/blob/main/veh_detect.pt")
18
+ # vehicle_classifier = YOLO("https://huggingface.co/Prabhat51/number-plate-models/blob/main/veh_class.pt")
19
+ # plate_detector = YOLO("https://huggingface.co/Prabhat51/number-plate-models/blob/main/plate_detect.pt")
20
+ veh_detect_path = hf_hub_download(repo_id="Prabhat51/number-plate-models", filename="veh_detect.pt")
21
+ vehicle_detector = YOLO(veh_detect_path)
22
+ vehicle_classifier_path = hf_hub_download(repo_id="Prabhat51/number-plate-models", filename="veh_class.pt")
23
+ vehicle_classifier = YOLO(vehicle_classifier_path)
24
+ plate_detector_path = hf_hub_download(repo_id="Prabhat51/number-plate-models", filename="plate_detect.pt")
25
+ plate_detector = YOLO(plate_detector_path)
26
  ocr_reader = PaddleOCR(use_angle_cls=True, lang='en')
27
  return vehicle_detector, vehicle_classifier, plate_detector, ocr_reader
28