jeffaudi commited on
Commit
ae7a302
·
1 Parent(s): fd174d3

Display confidence

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -68,22 +68,22 @@ def predict_image(image, threshold):
68
 
69
  points = [(coord[0], coord[1]) for coord in coords]
70
  draw.polygon(points, outline="red", width=LINE_WIDTH)
71
- draw.text((points[0][0], points[0][1]), detection['class_name'], fill="red")
72
 
73
  return image, img.shape, len(detections), duration
74
 
75
 
76
  # Define example images and their true labels for users to choose from
77
  example_data = [
78
- ["./demo/12ab97857.jpg", 0.8],
79
- ["./demo/82f13510a.jpg", 0.8],
80
- ["./demo/836f35381.jpg", 0.8],
81
- ["./demo/848d2afef.jpg", 0.8],
82
- ["./demo/911b25478.jpg", 0.8],
83
- ["./demo/b86e4046f.jpg", 0.8],
84
- ["./demo/ce2220f49.jpg", 0.8],
85
- ["./demo/d9762ef5e.jpg", 0.8],
86
- ["./demo/fa613751e.jpg", 0.8],
87
  # Add more example images and thresholds as needed
88
 
89
  ]
@@ -96,7 +96,7 @@ css = """
96
  }
97
  """
98
 
99
- TITLE = "Ship detection on Optical Satellite images (Oriented Bounding Boxes)"
100
 
101
  # Define the Gradio Interface
102
  demo = gr.Blocks(title=TITLE, css=css).queue()
 
68
 
69
  points = [(coord[0], coord[1]) for coord in coords]
70
  draw.polygon(points, outline="red", width=LINE_WIDTH)
71
+ draw.text((points[0][0], points[0][1]), detection['class_name'] + ' | ' + str(round(detection['confidence'], 3)), fill="red")
72
 
73
  return image, img.shape, len(detections), duration
74
 
75
 
76
  # Define example images and their true labels for users to choose from
77
  example_data = [
78
+ ["./demo/12ab97857.jpg", 0.6],
79
+ ["./demo/82f13510a.jpg", 0.6],
80
+ ["./demo/836f35381.jpg", 0.6],
81
+ ["./demo/848d2afef.jpg", 0.6],
82
+ ["./demo/911b25478.jpg", 0.6],
83
+ ["./demo/b86e4046f.jpg", 0.6],
84
+ ["./demo/ce2220f49.jpg", 0.6],
85
+ ["./demo/d9762ef5e.jpg", 0.6],
86
+ ["./demo/fa613751e.jpg", 0.6],
87
  # Add more example images and thresholds as needed
88
 
89
  ]
 
96
  }
97
  """
98
 
99
+ TITLE = "Ship detection on SPOT Satellite images (Oriented Bounding Boxes)"
100
 
101
  # Define the Gradio Interface
102
  demo = gr.Blocks(title=TITLE, css=css).queue()