Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
import gradio as gr
|
| 4 |
from PIL import Image, ImageDraw, ImageFont
|
| 5 |
from transformers import pipeline
|
|
@@ -62,16 +60,16 @@ def read_objects(detection_objects):
|
|
| 62 |
return response
|
| 63 |
|
| 64 |
def draw_bounding_boxes(image, detections, font_path=None, font_size=20):
|
| 65 |
-
"""
|
| 66 |
-
Draws bounding boxes on the given image based on the detections.
|
| 67 |
-
:param image: PIL.Image object
|
| 68 |
-
:param detections: List of detection results, where each result is a dictionary containing
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
:param font_path: Path to the TrueType font file to use for text.
|
| 72 |
-
:param font_size: Size of the font to use for text.
|
| 73 |
-
:return: PIL.Image object with bounding boxes drawn.
|
| 74 |
-
"""
|
| 75 |
# Make a copy of the image to draw on
|
| 76 |
draw_image = image.copy()
|
| 77 |
draw = ImageDraw.Draw(draw_image)
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image, ImageDraw, ImageFont
|
| 3 |
from transformers import pipeline
|
|
|
|
| 60 |
return response
|
| 61 |
|
| 62 |
def draw_bounding_boxes(image, detections, font_path=None, font_size=20):
|
| 63 |
+
# """
|
| 64 |
+
# Draws bounding boxes on the given image based on the detections.
|
| 65 |
+
# :param image: PIL.Image object
|
| 66 |
+
# :param detections: List of detection results, where each result is a dictionary containing
|
| 67 |
+
# 'score', 'label', and 'box' keys. 'box' itself is a dictionary with 'xmin',
|
| 68 |
+
# 'ymin', 'xmax', 'ymax'.
|
| 69 |
+
# :param font_path: Path to the TrueType font file to use for text.
|
| 70 |
+
# :param font_size: Size of the font to use for text.
|
| 71 |
+
# :return: PIL.Image object with bounding boxes drawn.
|
| 72 |
+
# """
|
| 73 |
# Make a copy of the image to draw on
|
| 74 |
draw_image = image.copy()
|
| 75 |
draw = ImageDraw.Draw(draw_image)
|