Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,6 @@ def download_models(model_id):
|
|
9 |
hf_hub_download("kadirnar/Yolov10", filename=f"{model_id}", local_dir=f"./")
|
10 |
return f"./{model_id}"
|
11 |
|
12 |
-
MODEL_PATH = 'yolov10n.pt'
|
13 |
-
model = YOLOv10(MODEL_PATH)
|
14 |
box_annotator = sv.BoxAnnotator()
|
15 |
category_dict = {
|
16 |
0: 'person', 1: 'bicycle', 2: 'car', 3: 'motorcycle', 4: 'airplane', 5: 'bus',
|
@@ -35,6 +33,7 @@ category_dict = {
|
|
35 |
@spaces.GPU(duration=200)
|
36 |
def yolov10_inference(image, model_id, image_size, conf_threshold, iou_threshold):
|
37 |
model_path = download_models(model_id)
|
|
|
38 |
results = model(source=image, imgsz=image_size, iou=iou_threshold, conf=conf_threshold, verbose=False)[0]
|
39 |
detections = sv.Detections.from_ultralytics(results)
|
40 |
|
|
|
9 |
hf_hub_download("kadirnar/Yolov10", filename=f"{model_id}", local_dir=f"./")
|
10 |
return f"./{model_id}"
|
11 |
|
|
|
|
|
12 |
box_annotator = sv.BoxAnnotator()
|
13 |
category_dict = {
|
14 |
0: 'person', 1: 'bicycle', 2: 'car', 3: 'motorcycle', 4: 'airplane', 5: 'bus',
|
|
|
33 |
@spaces.GPU(duration=200)
|
34 |
def yolov10_inference(image, model_id, image_size, conf_threshold, iou_threshold):
|
35 |
model_path = download_models(model_id)
|
36 |
+
model = YOLOv10(model_path)
|
37 |
results = model(source=image, imgsz=image_size, iou=iou_threshold, conf=conf_threshold, verbose=False)[0]
|
38 |
detections = sv.Detections.from_ultralytics(results)
|
39 |
|