Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import PIL.Image as Image
|
3 |
-
from ultralytics import YOLO
|
4 |
import spaces
|
5 |
import os
|
6 |
from huggingface_hub import hf_hub_download
|
@@ -16,7 +16,11 @@ def get_model_path(model_name):
|
|
16 |
@spaces.GPU
|
17 |
def yolo_inference(images, model_id, conf_threshold, iou_threshold, max_detection):
|
18 |
model_path = get_model_path(model_id) # Download model
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
results = model.predict(
|
21 |
source=images,
|
22 |
conf=conf_threshold,
|
|
|
1 |
import gradio as gr
|
2 |
import PIL.Image as Image
|
3 |
+
from ultralytics import YOLO, RTDETR
|
4 |
import spaces
|
5 |
import os
|
6 |
from huggingface_hub import hf_hub_download
|
|
|
16 |
@spaces.GPU
|
17 |
def yolo_inference(images, model_id, conf_threshold, iou_threshold, max_detection):
|
18 |
model_path = get_model_path(model_id) # Download model
|
19 |
+
if 'rtdetr' in model_id.lower():
|
20 |
+
model_type = RTDETR
|
21 |
+
else:
|
22 |
+
model_type = YOLO
|
23 |
+
model = model_type(model_path)
|
24 |
results = model.predict(
|
25 |
source=images,
|
26 |
conf=conf_threshold,
|