Update src/utils.py
Browse files- src/utils.py +2 -5
src/utils.py
CHANGED
@@ -16,7 +16,6 @@ def clean_text(text):
|
|
16 |
Returns:
|
17 |
str: The cleaned and properly formatted text.
|
18 |
"""
|
19 |
-
|
20 |
# Remove unwanted tokens
|
21 |
text = text.replace("<pad>", "").replace("</s>", "").strip()
|
22 |
|
@@ -51,14 +50,12 @@ def draw_ocr_bboxes(image: Image, detections: sv.Detections) -> Image:
|
|
51 |
Draws bounding boxes and labels on the input image based on the OCR detections.
|
52 |
|
53 |
Args:
|
54 |
-
image (PIL.Image): The input image on which to draw the bounding boxes and labels.
|
55 |
-
detections (sv.Detections): The OCR detections containing the bounding box coordinates and labels.
|
56 |
|
57 |
Returns:
|
58 |
PIL.Image: The annotated image with bounding boxes and labels.
|
59 |
-
|
60 |
"""
|
61 |
-
|
62 |
# Copy the input image to avoid modifying the original image
|
63 |
annotated_image = image.copy()
|
64 |
|
|
|
16 |
Returns:
|
17 |
str: The cleaned and properly formatted text.
|
18 |
"""
|
|
|
19 |
# Remove unwanted tokens
|
20 |
text = text.replace("<pad>", "").replace("</s>", "").strip()
|
21 |
|
|
|
50 |
Draws bounding boxes and labels on the input image based on the OCR detections.
|
51 |
|
52 |
Args:
|
53 |
+
- image (PIL.Image): The input image on which to draw the bounding boxes and labels.
|
54 |
+
- detections (sv.Detections): The OCR detections containing the bounding box coordinates and labels.
|
55 |
|
56 |
Returns:
|
57 |
PIL.Image: The annotated image with bounding boxes and labels.
|
|
|
58 |
"""
|
|
|
59 |
# Copy the input image to avoid modifying the original image
|
60 |
annotated_image = image.copy()
|
61 |
|