Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -182,12 +182,14 @@ def make_gif():
|
|
182 |
|
183 |
return out,out
|
184 |
def update_speed(inp,clip_speed,fps):
|
|
|
185 |
mod_fps=float(fps)*float(clip_speed)
|
186 |
clip = VideoFileClip(inp)
|
187 |
#final = clip.fx(vfx.speedx, clip_speed)
|
188 |
final = moviepy.video.fx.all.speedx(clip, factor=clip_speed)
|
189 |
-
final.write_videofile(f'{
|
190 |
-
|
|
|
191 |
with gr.Blocks() as app:
|
192 |
with gr.Tab("Load"):
|
193 |
with gr.Row():
|
@@ -251,8 +253,8 @@ with gr.Blocks() as app:
|
|
251 |
def echo_fn(inp):
|
252 |
return inp
|
253 |
#outp_vid.change(echo_fn,outp_vid,[out_trim])
|
254 |
-
speed_btn.click(update_speed,[hid_box,clip_speed,hid_fps],outp_vid)
|
255 |
-
gif_btn.click(make_gif,
|
256 |
trim_btn.click(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
|
257 |
outp_vid.change(load_video,outp_vid,[frame_count,fps,end_f]).then(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
|
258 |
frame_btn.click(capture_function,[out_trim],[frame_gal,frame_file,frame_stat])
|
|
|
182 |
|
183 |
return out,out
|
184 |
def update_speed(inp,clip_speed,fps):
|
185 |
+
out_inp = f'{inp.split(".mp4",1)[1]}-split.mp4')
|
186 |
mod_fps=float(fps)*float(clip_speed)
|
187 |
clip = VideoFileClip(inp)
|
188 |
#final = clip.fx(vfx.speedx, clip_speed)
|
189 |
final = moviepy.video.fx.all.speedx(clip, factor=clip_speed)
|
190 |
+
final.write_videofile(f'{out_inp}', fps=mod_fps)
|
191 |
+
out = f'{out_inp}'
|
192 |
+
return out,out
|
193 |
with gr.Blocks() as app:
|
194 |
with gr.Tab("Load"):
|
195 |
with gr.Row():
|
|
|
253 |
def echo_fn(inp):
|
254 |
return inp
|
255 |
#outp_vid.change(echo_fn,outp_vid,[out_trim])
|
256 |
+
speed_btn.click(update_speed,[hid_box,clip_speed,hid_fps],[outp_vid,hid_box])
|
257 |
+
gif_btn.click(make_gif,hid_box,[gif_show,gif_file])
|
258 |
trim_btn.click(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
|
259 |
outp_vid.change(load_video,outp_vid,[frame_count,fps,end_f]).then(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
|
260 |
frame_btn.click(capture_function,[out_trim],[frame_gal,frame_file,frame_stat])
|