kadirnar commited on
Commit
a6972d6
·
verified ·
1 Parent(s): 2d1e08b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,13 +1,12 @@
1
  import gradio as gr
2
 
3
 
4
- def yolov9_inference(model_path, device, conf_threshold, iou_threshold, img_path, size=640):
5
  """
6
  Load a YOLOv9 model, configure it, perform inference on an image, and optionally adjust
7
  the input size and apply test time augmentation.
8
 
9
  :param model_path: Path to the YOLOv9 model file.
10
- :param device: Computation device, 'cpu' or 'cuda'.
11
  :param conf_threshold: Confidence threshold for NMS.
12
  :param iou_threshold: IoU threshold for NMS.
13
  :param img_path: Path to the image file.
@@ -18,14 +17,14 @@ def yolov9_inference(model_path, device, conf_threshold, iou_threshold, img_path
18
  import yolov9
19
 
20
  # Load the model
21
- model = yolov9.load(model_path, device=device)
22
 
23
  # Set model parameters
24
  model.conf = conf_threshold
25
  model.iou = iou_threshold
26
 
27
  # Perform inference
28
- results = model(img_path, size=size)
29
 
30
  # Optionally, show detection bounding boxes on image
31
  save_path = 'output/'
 
1
  import gradio as gr
2
 
3
 
4
+ def yolov9_inference(img_path, model_path,image_size, conf_threshold, iou_threshold):
5
  """
6
  Load a YOLOv9 model, configure it, perform inference on an image, and optionally adjust
7
  the input size and apply test time augmentation.
8
 
9
  :param model_path: Path to the YOLOv9 model file.
 
10
  :param conf_threshold: Confidence threshold for NMS.
11
  :param iou_threshold: IoU threshold for NMS.
12
  :param img_path: Path to the image file.
 
17
  import yolov9
18
 
19
  # Load the model
20
+ model = yolov9.load(model_path, device="cpu")
21
 
22
  # Set model parameters
23
  model.conf = conf_threshold
24
  model.iou = iou_threshold
25
 
26
  # Perform inference
27
+ results = model(img_path, size=image_size)
28
 
29
  # Optionally, show detection bounding boxes on image
30
  save_path = 'output/'