Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -71,15 +71,14 @@ def text_to_video(text, voice, rate, pitch, video_width, video_height, bg_color,
|
|
71 |
audio_clips.append(audio_clip)
|
72 |
|
73 |
# 使用 wand 生成视频片段
|
74 |
-
with Drawing() as draw:
|
75 |
-
|
76 |
-
draw.font = font_path
|
77 |
draw.font_size = text_size
|
78 |
draw.fill_color = Color(text_color)
|
79 |
draw.text_alignment = 'center'
|
80 |
draw.text_interline_spacing = 10
|
81 |
-
|
82 |
-
#
|
83 |
with Image(width=video_width, height=video_height, background=Color(bg_color)) as img:
|
84 |
lines = page.split("\n")
|
85 |
for j, line in enumerate(lines):
|
@@ -96,7 +95,7 @@ def text_to_video(text, voice, rate, pitch, video_width, video_height, bg_color,
|
|
96 |
# Create the video clip using the generated image
|
97 |
text_clip = ImageClip(img_path).set_duration(audio_clip.duration).set_audio(audio_clip)
|
98 |
video_clips.append(text_clip)
|
99 |
-
|
100 |
# 合并所有视频片段
|
101 |
final_video = concatenate_videoclips(video_clips)
|
102 |
final_video_path = os.path.join(tempfile.gettempdir(), "output_video.mp4")
|
|
|
71 |
audio_clips.append(audio_clip)
|
72 |
|
73 |
# 使用 wand 生成视频片段
|
74 |
+
with Drawing() as draw: # Ensure this block is indented properly
|
75 |
+
draw.font = font_path # Indent this line with 4 spaces
|
|
|
76 |
draw.font_size = text_size
|
77 |
draw.fill_color = Color(text_color)
|
78 |
draw.text_alignment = 'center'
|
79 |
draw.text_interline_spacing = 10
|
80 |
+
|
81 |
+
# Create the image with another 'with' block, indented
|
82 |
with Image(width=video_width, height=video_height, background=Color(bg_color)) as img:
|
83 |
lines = page.split("\n")
|
84 |
for j, line in enumerate(lines):
|
|
|
95 |
# Create the video clip using the generated image
|
96 |
text_clip = ImageClip(img_path).set_duration(audio_clip.duration).set_audio(audio_clip)
|
97 |
video_clips.append(text_clip)
|
98 |
+
|
99 |
# 合并所有视频片段
|
100 |
final_video = concatenate_videoclips(video_clips)
|
101 |
final_video_path = os.path.join(tempfile.gettempdir(), "output_video.mp4")
|