kadirnar commited on
Commit
14bbece
·
verified ·
1 Parent(s): 5c0b724

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -11
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
- save_path = 'output/'
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 output_path
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="filepath",label="Output Image")
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(