Spaces:
Runtime error
Runtime error
Create utils_.py
Browse files
utils_.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from urllib.request import urlretrieve
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
RECOGNITION_MODEL_PATH = 'https://github.com/yMayanand/number_plate_recognition/releases/download/v1.0/ocr_point08.pt'
|
| 5 |
+
DETECTION_MODEL_PATH = 'https://github.com/yMayanand/number_plate_recognition/releases/download/v1.0/detection.pt'
|
| 6 |
+
|
| 7 |
+
os.makedirs('./out', exist_ok=True)
|
| 8 |
+
|
| 9 |
+
reco_model = './out/ocr_point08.pt'
|
| 10 |
+
det_model = './out/detection.pt'
|
| 11 |
+
|
| 12 |
+
if not os.path.exists(reco_model) or not os.path.exists(det_model):
|
| 13 |
+
print('🚀 Downloading Model Weights...')
|
| 14 |
+
urlretrieve(RECOGNITION_MODEL_PATH, reco_model)
|
| 15 |
+
urlretrieve(DETECTION_MODEL_PATH, det_model)
|
| 16 |
+
else:
|
| 17 |
+
print('Model Weights already there')
|