hivecorp commited on
Commit
762013d
·
verified ·
1 Parent(s): 9e41260

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -80,14 +80,9 @@ def text_to_video(text, voice, rate, pitch, video_width, video_height, bg_color,
80
 
81
  with Image(width=video_width, height=video_height, background=Color(bg_color)) as img:
82
  lines = page.split("\n")
83
- # Centering text vertically
84
- total_text_height = len(lines) * (text_size + 10) # Height of text area
85
- start_y = (video_height - total_text_height) // 2 # Start position to center vertically
86
-
87
  for j, line in enumerate(lines):
88
- draw.text(int(video_width / 2), start_y + (j * (text_size + 10)), line)
89
-
90
- draw(img) # Apply the drawing to the image
91
  img.format = 'png'
92
  img_path = os.path.join(tempfile.gettempdir(), f"page_{i}.png")
93
  img.save(filename=img_path)
 
80
 
81
  with Image(width=video_width, height=video_height, background=Color(bg_color)) as img:
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)