product2204 commited on
Commit
6d09fb7
1 Parent(s): 9671d7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -71,7 +71,7 @@ def process_segment(text, query, index):
71
  audio_path = generate_voice_from_text(text, query)
72
 
73
  audio_clip = mpe.AudioFileClip(audio_path)
74
- # Trim the video to the desired duration (first 10 seconds)
75
  if video_clip.duration > audio_clip.duration:
76
  video_clip = video_clip.subclip(0, audio_clip.duration)
77
  else:
@@ -110,18 +110,15 @@ def process_video_paragraph(text):
110
  video_clips.append(video_clip)
111
  else:
112
  print("No video segments to concatenate.")
 
 
 
 
 
 
 
113
 
114
- if video_clips:
115
- final_video = concatenate_videoclips(video_clips)
116
- final_video.write_videofile("final_output.mp4", codec="libx264", fps=24)
117
- print("Final video created successfully.")
118
- else:
119
- print("No video segments to concatenate.")
120
-
121
-
122
- # This will prompt a download dialog in the browser
123
- return "final_output.mp4"
124
-
125
  import gradio as gr
126
 
127
 
 
71
  audio_path = generate_voice_from_text(text, query)
72
 
73
  audio_clip = mpe.AudioFileClip(audio_path)
74
+ # Trim the video to the desired duration
75
  if video_clip.duration > audio_clip.duration:
76
  video_clip = video_clip.subclip(0, audio_clip.duration)
77
  else:
 
110
  video_clips.append(video_clip)
111
  else:
112
  print("No video segments to concatenate.")
113
+ clips = [mpe.VideoFileClip(vp) for vp in video_clips]
114
+ if clips:
115
+ final_video = concatenate_videoclips(clips)
116
+ final_output_path = "final_concatenated_video.mp4"
117
+ final_video.write_videofile(final_output_path, codec="libx264", fps=24)
118
+ print(f"Final concatenated video created: {final_output_path}")
119
+ return final_output_path
120
 
121
+
 
 
 
 
 
 
 
 
 
 
122
  import gradio as gr
123
 
124