hivecorp commited on
Commit
0ff6e15
·
verified ·
1 Parent(s): 762013d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -70,6 +70,7 @@ def text_to_video(text, voice, rate, pitch, video_width, video_height, bg_color,
70
  audio_clip = AudioFileClip(audio)
71
  audio_clips.append(audio_clip)
72
 
 
73
  # 使用 wand 生成视频片段
74
  with Drawing() as draw:
75
  draw.font = font_path
@@ -82,7 +83,8 @@ def text_to_video(text, voice, rate, pitch, video_width, video_height, bg_color,
82
  lines = page.split("\n")
83
  for j, line in enumerate(lines):
84
  draw.text(int(video_width / 2), (j + 1) * (text_size + 10), line)
85
- img.draw(draw)
 
86
  img.format = 'png'
87
  img_path = os.path.join(tempfile.gettempdir(), f"page_{i}.png")
88
  img.save(filename=img_path)
 
70
  audio_clip = AudioFileClip(audio)
71
  audio_clips.append(audio_clip)
72
 
73
+ # 使用 wand 生成视频片段
74
  # 使用 wand 生成视频片段
75
  with Drawing() as draw:
76
  draw.font = font_path
 
83
  lines = page.split("\n")
84
  for j, line in enumerate(lines):
85
  draw.text(int(video_width / 2), (j + 1) * (text_size + 10), line)
86
+
87
+ draw(img) # Apply the drawing to the image
88
  img.format = 'png'
89
  img_path = os.path.join(tempfile.gettempdir(), f"page_{i}.png")
90
  img.save(filename=img_path)