Spaces:
Running
Running
ChenyuRabbitLove
commited on
Commit
•
ac80710
1
Parent(s):
a1f2ff4
bugfix: fix minor bugs
Browse files
utils/completion_reward.py
CHANGED
@@ -485,14 +485,14 @@ class ImageProcessor:
|
|
485 |
# Draw the text
|
486 |
title_font = ImageFont.truetype("NotoSansTC-Bold.ttf", 34)
|
487 |
body_font = ImageFont.truetype("NotoSansTC-Light.ttf", 14)
|
488 |
-
|
489 |
# Calculate space required by the paragraph
|
490 |
paragraph_height = 0
|
491 |
for line in paragraph.split("\n"):
|
492 |
-
wrapped_lines = textwrap.wrap(line, width=
|
493 |
for wrapped_line in wrapped_lines:
|
494 |
_, _, _, line_height = draw.textbbox((0, 0), wrapped_line, font=body_font)
|
495 |
-
paragraph_height += line_height +
|
496 |
|
497 |
|
498 |
# Draw the box
|
@@ -525,7 +525,7 @@ class ImageProcessor:
|
|
525 |
body_x, body_y = left + 20, title_y + 60 # Adjust position as needed
|
526 |
|
527 |
for line in paragraph.split("\n"):
|
528 |
-
wrapped_lines = textwrap.wrap(line, width=
|
529 |
for wrapped_line in wrapped_lines:
|
530 |
draw.text((body_x, body_y), wrapped_line, font=body_font, fill="black")
|
531 |
body_y += 25
|
|
|
485 |
# Draw the text
|
486 |
title_font = ImageFont.truetype("NotoSansTC-Bold.ttf", 34)
|
487 |
body_font = ImageFont.truetype("NotoSansTC-Light.ttf", 14)
|
488 |
+
|
489 |
# Calculate space required by the paragraph
|
490 |
paragraph_height = 0
|
491 |
for line in paragraph.split("\n"):
|
492 |
+
wrapped_lines = textwrap.wrap(line, width=63)
|
493 |
for wrapped_line in wrapped_lines:
|
494 |
_, _, _, line_height = draw.textbbox((0, 0), wrapped_line, font=body_font)
|
495 |
+
paragraph_height += line_height + 10
|
496 |
|
497 |
|
498 |
# Draw the box
|
|
|
525 |
body_x, body_y = left + 20, title_y + 60 # Adjust position as needed
|
526 |
|
527 |
for line in paragraph.split("\n"):
|
528 |
+
wrapped_lines = textwrap.wrap(line, width=63)
|
529 |
for wrapped_line in wrapped_lines:
|
530 |
draw.text((body_x, body_y), wrapped_line, font=body_font, fill="black")
|
531 |
body_y += 25
|