deepsync commited on
Commit
87eb09c
·
verified ·
1 Parent(s): 6377b99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -2,7 +2,6 @@ import os
2
  from uuid import uuid4
3
  import gradio as gr
4
  from moviepy.editor import VideoFileClip, concatenate_videoclips
5
- from tempfile import TemporaryDirectory
6
 
7
  def concatenate(video_clip_paths, output_path, method="compose"):
8
  clips = [VideoFileClip(c) for c in video_clip_paths]
@@ -16,11 +15,10 @@ def concatenate(video_clip_paths, output_path, method="compose"):
16
  final_clip.write_videofile(output_path)
17
 
18
  def merge(dubbed_video, end_video):
19
- with TemporaryDirectory() as dir:
20
- outpath = os.path.join(dir, f"{uuid4()}.mp4")
21
- video_clip_paths = [dubbed_video, end_video]
22
- concatenate(video_clip_paths, outpath)
23
- return outpath
24
 
25
  input_video_file = gr.Video(label="Upload video")
26
  end_video_file = gr.Video(label="End video", value="end.mp4")
 
2
  from uuid import uuid4
3
  import gradio as gr
4
  from moviepy.editor import VideoFileClip, concatenate_videoclips
 
5
 
6
  def concatenate(video_clip_paths, output_path, method="compose"):
7
  clips = [VideoFileClip(c) for c in video_clip_paths]
 
15
  final_clip.write_videofile(output_path)
16
 
17
  def merge(dubbed_video, end_video):
18
+ outpath = f"{uuid4()}.mp4"
19
+ video_clip_paths = [dubbed_video, end_video]
20
+ concatenate(video_clip_paths, outpath)
21
+ return outpath
 
22
 
23
  input_video_file = gr.Video(label="Upload video")
24
  end_video_file = gr.Video(label="End video", value="end.mp4")