Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def add_label_to_image(image, label):
|
|
20 |
# Calculate the size and position of the text (aligned to the left)
|
21 |
text_bbox = draw.textbbox((0, 0), label, font=font)
|
22 |
text_width, text_height = text_bbox[2] - text_bbox[0], text_bbox[3] - text_bbox[1]
|
23 |
-
position = (image.
|
24 |
|
25 |
# Add a semi-transparent rectangle behind the text for better visibility
|
26 |
rect_margin = 10
|
|
|
20 |
# Calculate the size and position of the text (aligned to the left)
|
21 |
text_bbox = draw.textbbox((0, 0), label, font=font)
|
22 |
text_width, text_height = text_bbox[2] - text_bbox[0], text_bbox[3] - text_bbox[1]
|
23 |
+
position = (image.width - text_width - 20, image.height - text_height - 20)# right-aligned with margin
|
24 |
|
25 |
# Add a semi-transparent rectangle behind the text for better visibility
|
26 |
rect_margin = 10
|