Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
import cv2
|
4 |
import numpy as np
|
5 |
-
from ultralytics import YOLO
|
6 |
-
|
7 |
-
def load_model(model_path="ddr.pt"):
|
8 |
-
return YOLO(model_path)
|
9 |
-
|
10 |
-
model = load_model()
|
11 |
|
12 |
-
def
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
iface = gr.Interface(
|
18 |
fn=predict,
|
|
|
1 |
import gradio as gr
|
2 |
+
from ultralytics import YOLO
|
3 |
import cv2
|
4 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
def detect_objects(image):
|
7 |
+
model = YOLO("./ddr.pt") # Load the trained model
|
8 |
+
results = model(image, conf=0.10) # Run inference with confidence threshold
|
9 |
+
|
10 |
+
output_image = results[0].plot() # Get the image with bounding boxes
|
11 |
+
return output_image
|
12 |
|
13 |
iface = gr.Interface(
|
14 |
fn=predict,
|