younes21000 commited on
Commit
cf20236
·
verified ·
1 Parent(s): cb2049f

Update app.py

Browse files

fixing down video part

Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -130,7 +130,12 @@ def download_video():
130
  generator = lambda txt: TextClip(txt, font='Arial', fontsize=24, color='white')
131
 
132
  # Generate subtitles (assuming each subtitle appears for 5 seconds)
133
- subs = [(i * 5, translated_subtitle[i:i+50]) for i in range(0, len(translated_subtitle), 50)]
 
 
 
 
 
134
 
135
  # Create subtitle clips
136
  subtitles = SubtitlesClip(subs, generator)
 
130
  generator = lambda txt: TextClip(txt, font='Arial', fontsize=24, color='white')
131
 
132
  # Generate subtitles (assuming each subtitle appears for 5 seconds)
133
+ subs = []
134
+ subtitle_length = 5 # seconds each subtitle will be displayed
135
+ for i in range(0, len(translated_subtitle), 50):
136
+ start_time = (i // 50) * subtitle_length
137
+ subtitle_text = translated_subtitle[i:i + 50] # Get the next 50 characters
138
+ subs.append((start_time, subtitle_text)) # Create a tuple for start time and text
139
 
140
  # Create subtitle clips
141
  subtitles = SubtitlesClip(subs, generator)