Omnibus commited on
Commit
5c36bf4
·
1 Parent(s): d98dc4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -197,11 +197,19 @@ def other():
197
  frame_num=f'Working on {i+1} of {frame_count}'
198
  yield fbox2,frame_num,None
199
 
200
- def make_gif():
 
 
 
201
  clip = VideoFileClip(f"{uid}-clip.mp4")
202
- clip.write_gif(f"{uid}/clip_gif.gif")
 
 
 
 
203
  out = f"{uid}/clip_gif.gif"
204
- return out,out
 
205
 
206
  def update_speed(inp,clip_speed,fps):
207
  if "-split.mp4" in inp:
@@ -298,7 +306,7 @@ with gr.Blocks() as app:
298
  #outp_vid.change(echo_fn,outp_vid,[out_trim])
299
  info_btn.click(dl_json,inp_url,info_json)
300
  speed_btn.click(update_speed,[hid_box,clip_speed,hid_fps],[outp_vid,hid_box])
301
- gif_btn.click(make_gif,None,[gif_show,gif_file])
302
  trim_btn.click(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
303
  outp_vid.change(load_video,outp_vid,[frame_count,fps,end_f,hid_box]).then(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
304
  frame_btn.click(capture_function,[out_trim],[frame_gal,frame_file,frame_stat])
 
197
  frame_num=f'Working on {i+1} of {frame_count}'
198
  yield fbox2,frame_num,None
199
 
200
+ def make_gif(fps):
201
+ _=None
202
+ mes="Gathering Video..."
203
+ yield _,_,mes
204
  clip = VideoFileClip(f"{uid}-clip.mp4")
205
+ mes="Writing GIF"
206
+ yield _,_,mes
207
+ clip.write_gif(f"{uid}/clip_gif.gif",program='ffmpeg', fps=float(fps))
208
+ mes="Saving GIF"
209
+ yield _,_,mes
210
  out = f"{uid}/clip_gif.gif"
211
+ mes="GIF Complete"
212
+ yield out,out,mes
213
 
214
  def update_speed(inp,clip_speed,fps):
215
  if "-split.mp4" in inp:
 
306
  #outp_vid.change(echo_fn,outp_vid,[out_trim])
307
  info_btn.click(dl_json,inp_url,info_json)
308
  speed_btn.click(update_speed,[hid_box,clip_speed,hid_fps],[outp_vid,hid_box])
309
+ gif_btn.click(make_gif,fps,[gif_show,gif_file,gif_stat])
310
  trim_btn.click(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
311
  outp_vid.change(load_video,outp_vid,[frame_count,fps,end_f,hid_box]).then(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
312
  frame_btn.click(capture_function,[out_trim],[frame_gal,frame_file,frame_stat])