Spaces:
Runtime error
Runtime error
Upload detect.py
Browse files
detect.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
|
3 |
+
def load_model(model_path):
|
4 |
+
model = torch.hub.load('ultralytics/yolov5', 'custom', path=model_path)
|
5 |
+
return model
|
6 |
+
|
7 |
+
def detect(image, model):
|
8 |
+
results = model(image)
|
9 |
+
return results
|
10 |
+
|