Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -74,17 +74,7 @@ def read_objects(detection_objects):
|
|
| 74 |
|
| 75 |
|
| 76 |
def draw_bounding_boxes(image, detections, font_path=None, font_size=20):
|
| 77 |
-
|
| 78 |
-
Draws bounding boxes on the given image based on the detections.
|
| 79 |
-
|
| 80 |
-
:param image: PIL.Image object
|
| 81 |
-
:param detections: List of detection results, where each result is a dictionary containing
|
| 82 |
-
'score', 'label', and 'box' keys. 'box' itself is a dictionary with 'xmin',
|
| 83 |
-
'ymin', 'xmax', 'ymax'.
|
| 84 |
-
:param font_path: Path to the TrueType font file to use for text.
|
| 85 |
-
:param font_size: Size of the font to use for text.
|
| 86 |
-
:return: PIL.Image object with bounding boxes drawn.
|
| 87 |
-
"""
|
| 88 |
# Make a copy of the image to draw on
|
| 89 |
draw_image = image.copy()
|
| 90 |
draw = ImageDraw.Draw(draw_image)
|
|
@@ -137,7 +127,7 @@ def detect_object(image):
|
|
| 137 |
demo = gr.Interface(fn=detect_object,
|
| 138 |
inputs=[gr.Image(label="Select Image",type="pil")],
|
| 139 |
outputs=[gr.Image(label="Processed Image", type="pil"), gr.Audio(label="Generated Audio")],
|
| 140 |
-
title="
|
| 141 |
description="THIS APPLICATION WILL BE USED TO HIGHLIGHT OBJECTS AND GIVES AUDIO DESCRIPTION FOR THE PROVIDED INPUT IMAGE.")
|
| 142 |
demo.launch()
|
| 143 |
|
|
|
|
| 74 |
|
| 75 |
|
| 76 |
def draw_bounding_boxes(image, detections, font_path=None, font_size=20):
|
| 77 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
# Make a copy of the image to draw on
|
| 79 |
draw_image = image.copy()
|
| 80 |
draw = ImageDraw.Draw(draw_image)
|
|
|
|
| 127 |
demo = gr.Interface(fn=detect_object,
|
| 128 |
inputs=[gr.Image(label="Select Image",type="pil")],
|
| 129 |
outputs=[gr.Image(label="Processed Image", type="pil"), gr.Audio(label="Generated Audio")],
|
| 130 |
+
title="Object Detector with Audio",
|
| 131 |
description="THIS APPLICATION WILL BE USED TO HIGHLIGHT OBJECTS AND GIVES AUDIO DESCRIPTION FOR THE PROVIDED INPUT IMAGE.")
|
| 132 |
demo.launch()
|
| 133 |
|