Spaces:
Runtime error
Runtime error
zfff
Browse files- video_generator.py +2 -2
video_generator.py
CHANGED
|
@@ -15,12 +15,12 @@ def generate_lyric_frame(lyric, image_size):
|
|
| 15 |
|
| 16 |
# Define font and text alignment
|
| 17 |
font = ImageFont.load_default()
|
| 18 |
-
text_width, text_height =
|
| 19 |
text_x = (image_size[0] - text_width) / 2
|
| 20 |
text_y = (image_size[1] - text_height) / 2
|
| 21 |
|
| 22 |
# Draw the text on the image
|
| 23 |
-
draw.text((text_x, text_y), lyric, font=font, fill='white')
|
| 24 |
return image
|
| 25 |
|
| 26 |
def generate_video(lyrics_with_timing, image_size=(800, 600), frame_rate=30):
|
|
|
|
| 15 |
|
| 16 |
# Define font and text alignment
|
| 17 |
font = ImageFont.load_default()
|
| 18 |
+
text_width, text_height = font.getsize(lyric) # Correcting the line here
|
| 19 |
text_x = (image_size[0] - text_width) / 2
|
| 20 |
text_y = (image_size[1] - text_height) / 2
|
| 21 |
|
| 22 |
# Draw the text on the image
|
| 23 |
+
draw.text((text_x, text_y), lyric, font=font, fill='white')
|
| 24 |
return image
|
| 25 |
|
| 26 |
def generate_video(lyrics_with_timing, image_size=(800, 600), frame_rate=30):
|