Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -29,17 +29,9 @@ def yolov9_inference(img_path, model_path,image_size, conf_threshold, iou_thresh
|
|
29 |
results = model(img_path, size=image_size)
|
30 |
|
31 |
# Optionally, show detection bounding boxes on image
|
32 |
-
|
33 |
-
results.save(labels=True, save_dir=save_path, exist_ok=True)
|
34 |
-
print("save_path:",save_path)
|
35 |
-
print("img_path:",img_path)
|
36 |
-
|
37 |
-
new_image_path = os.path.basename(img_path)
|
38 |
-
output_path = save_path + new_image_path
|
39 |
-
|
40 |
-
print(f"Output image saved to {output_path}")
|
41 |
|
42 |
-
return
|
43 |
|
44 |
|
45 |
inputs = [
|
@@ -59,7 +51,7 @@ inputs = [
|
|
59 |
gr.Slider(minimum=0.0, maximum=1.0, value=0.45, step=0.05, label="IOU Threshold"),
|
60 |
]
|
61 |
|
62 |
-
outputs = gr.Image(type="
|
63 |
title = "YOLOv9"
|
64 |
|
65 |
demo_app = gr.Interface(
|
|
|
29 |
results = model(img_path, size=image_size)
|
30 |
|
31 |
# Optionally, show detection bounding boxes on image
|
32 |
+
output = results.render()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
return output[0]
|
35 |
|
36 |
|
37 |
inputs = [
|
|
|
51 |
gr.Slider(minimum=0.0, maximum=1.0, value=0.45, step=0.05, label="IOU Threshold"),
|
52 |
]
|
53 |
|
54 |
+
outputs = gr.Image(type="numpy",label="Output Image")
|
55 |
title = "YOLOv9"
|
56 |
|
57 |
demo_app = gr.Interface(
|