Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -255,7 +255,7 @@ def transcribe(audio):
|
|
255 |
segments, info = model.transcribe(audio)
|
256 |
segments = list(segments)
|
257 |
for segment in segments:
|
258 |
-
print("[%.2fs -> %.2fs] %s" % (segment.start
|
259 |
return segments
|
260 |
|
261 |
def format_time(seconds):
|
@@ -405,7 +405,7 @@ def process_video(url, type):
|
|
405 |
subtitles = pysrt.open("google_translate.srt", encoding="utf-8")
|
406 |
output_video_file = input_video_name + '_subtitled' + ".mp4"
|
407 |
subtitle_clips = create_subtitle_clips(subtitles, video.size, 32, 'arial.ttf', 'white', False)
|
408 |
-
final_video = CompositeVideoClip([video] + subtitle_clips)
|
409 |
final_video.write_videofile(output_video_file, codec="libx264", audio_codec="aac", logger=None)
|
410 |
print('final')
|
411 |
# Get the current local time
|
|
|
255 |
segments, info = model.transcribe(audio)
|
256 |
segments = list(segments)
|
257 |
for segment in segments:
|
258 |
+
print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
|
259 |
return segments
|
260 |
|
261 |
def format_time(seconds):
|
|
|
405 |
subtitles = pysrt.open("google_translate.srt", encoding="utf-8")
|
406 |
output_video_file = input_video_name + '_subtitled' + ".mp4"
|
407 |
subtitle_clips = create_subtitle_clips(subtitles, video.size, 32, 'arial.ttf', 'white', False)
|
408 |
+
final_video = CompositeVideoClip([video] + subtitle_clips.with_start(1))
|
409 |
final_video.write_videofile(output_video_file, codec="libx264", audio_codec="aac", logger=None)
|
410 |
print('final')
|
411 |
# Get the current local time
|