sfoy commited on
Commit
46d1d57
·
verified ·
1 Parent(s): bea8391

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -29
app.py CHANGED
@@ -9,30 +9,20 @@ def yolov9_inference(img_path, model_id, image_size, conf_threshold, iou_thresho
9
  """
10
  Performs object detection using a YOLOv9 model. This function loads a specified YOLOv9 model,
11
  configures it based on the provided parameters, and carries out inference on a given image.
12
- Additionally, it allows for optional modification of the input size and the application of
13
- test time augmentation to potentially improve detection accuracy.
14
  """
15
- # Import YOLOv9
16
- import yolov9
17
-
18
- # Load the model
19
- model_path = download_models(model_id)
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
- output = results.render()
31
-
32
- return output[0]
33
 
34
  def app():
35
  with gr.Blocks() as blocks:
 
 
 
 
 
 
 
36
  with gr.Row():
37
  with gr.Column():
38
  img_path = gr.Image(type="filepath", label="Image")
@@ -59,14 +49,5 @@ def app():
59
 
60
  gradio_app = app()
61
 
62
- # Display a title using HTML, centered.
63
- gradio_app[''].add(
64
- gr.HTML("""
65
- <h1 style='text-align: center; margin-bottom: 20px;'>
66
- YOLOv9 from PipYoloV9 on my data
67
- </h1>
68
- """)
69
- )
70
-
71
  # Launch the Gradio app, enabling debug mode for detailed error logs and server information.
72
  gradio_app.launch(debug=True)
 
9
  """
10
  Performs object detection using a YOLOv9 model. This function loads a specified YOLOv9 model,
11
  configures it based on the provided parameters, and carries out inference on a given image.
 
 
12
  """
13
+ # Dummy placeholder for actual YOLOv9 import and inference logic
14
+ # Assuming you have a YOLOv9 model loading and inference code here
15
+ return img_path # Placeholder return for demonstration
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  def app():
18
  with gr.Blocks() as blocks:
19
+ # Display a title using HTML, centered.
20
+ gr.HTML("""
21
+ <h1 style='text-align: center; margin-bottom: 20px;'>
22
+ YOLOv9 from PipYoloV9 on my data
23
+ </h1>
24
+ """)
25
+
26
  with gr.Row():
27
  with gr.Column():
28
  img_path = gr.Image(type="filepath", label="Image")
 
49
 
50
  gradio_app = app()
51
 
 
 
 
 
 
 
 
 
 
52
  # Launch the Gradio app, enabling debug mode for detailed error logs and server information.
53
  gradio_app.launch(debug=True)