SakshiRathi77 commited on
Commit
97ff8bc
·
verified ·
1 Parent(s): 2fea6fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -8,7 +8,7 @@ from huggingface_hub import hf_hub_download
8
  # return f"./{model_id}"
9
 
10
 
11
- def yolov9_inference(img_path, model_id, image_size, conf_threshold, iou_threshold):
12
  """
13
  Load a YOLOv9 model, configure it, perform inference on an image, and optionally adjust
14
  the input size and apply test time augmentation.
@@ -25,7 +25,7 @@ def yolov9_inference(img_path, model_id, image_size, conf_threshold, iou_thresho
25
 
26
  # Load the model
27
  # model_path = download_models()
28
- model = yolov9.load(best.pt, device="cuda:0")
29
 
30
  # Set model parameters
31
  model.conf = conf_threshold
@@ -45,7 +45,6 @@ def app():
45
  with gr.Row():
46
  with gr.Column():
47
  img_path = gr.Image(type="filepath", label="Image")
48
- model_path = "best.pt"
49
  image_size = gr.Slider(
50
  label="Image Size",
51
  minimum=320,
@@ -76,7 +75,7 @@ def app():
76
  fn=yolov9_inference,
77
  inputs=[
78
  img_path,
79
- model_path,
80
  image_size,
81
  conf_threshold,
82
  iou_threshold,
 
8
  # return f"./{model_id}"
9
 
10
 
11
+ def yolov9_inference(img_path, image_size, conf_threshold, iou_threshold):
12
  """
13
  Load a YOLOv9 model, configure it, perform inference on an image, and optionally adjust
14
  the input size and apply test time augmentation.
 
25
 
26
  # Load the model
27
  # model_path = download_models()
28
+ model = yolov9.load("./best.pt")
29
 
30
  # Set model parameters
31
  model.conf = conf_threshold
 
45
  with gr.Row():
46
  with gr.Column():
47
  img_path = gr.Image(type="filepath", label="Image")
 
48
  image_size = gr.Slider(
49
  label="Image Size",
50
  minimum=320,
 
75
  fn=yolov9_inference,
76
  inputs=[
77
  img_path,
78
+ # model_path,
79
  image_size,
80
  conf_threshold,
81
  iou_threshold,