Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -37,11 +37,7 @@ def load_video(vid):
|
|
37 |
minutes = int(vid_t/60)-(hours*360)
|
38 |
seconds = vid_t-(minutes*60)-(hours*360)
|
39 |
vid_len = f'{hours}:{minutes}:{seconds}'
|
40 |
-
|
41 |
-
idx_vid = gr.update(value="GIF")
|
42 |
-
else:
|
43 |
-
idx_vid = gr.update(value="Video")
|
44 |
-
return frame_count, fps, vid_len, vid,idx_vid
|
45 |
def im_2_vid(images,fps):
|
46 |
this_im=cv2.imread(images[0])
|
47 |
height=this_im.shape[0]
|
@@ -254,7 +250,6 @@ with gr.Blocks(css=css) as app:
|
|
254 |
outp_img=gr.Image(label="Enhanced Image")
|
255 |
with gr.Box(visible=False) as vid_box:
|
256 |
with gr.Group():
|
257 |
-
idx_vid=gr.Radio(choices=["Video","GIF"])
|
258 |
inp_url = gr.Textbox(label="Video URL")
|
259 |
go_btn = gr.Button("Run")
|
260 |
outp_vid=gr.Video(format="mp4")
|
@@ -272,8 +267,7 @@ with gr.Blocks(css=css) as app:
|
|
272 |
out_trim=gr.Video(format="mp4")
|
273 |
hid_box = gr.Textbox(visible=True)
|
274 |
hid_fps = gr.Textbox(visible=True)
|
275 |
-
|
276 |
-
choose_prog=gr.Radio(label="GIF Engine",choices=['imageio','ImageMagick','ffmpeg'], value = "imageio")
|
277 |
with gr.Row():
|
278 |
qual=gr.Checkbox(label="Improve Quality (slow)",value=False)
|
279 |
with gr.Accordion("Quality Options", open=False):
|
@@ -294,9 +288,13 @@ with gr.Blocks(css=css) as app:
|
|
294 |
samp_btn=gr.Button("Get Sample")
|
295 |
samp_im = gr.Image(label="Sample Frame")
|
296 |
|
297 |
-
|
298 |
-
|
299 |
-
|
|
|
|
|
|
|
|
|
300 |
with gr.Row(visible=False) as vid_row:
|
301 |
vid_btn = gr.Button("Make Video")
|
302 |
vid_stat=gr.Textbox(label="Status")
|
@@ -366,7 +364,7 @@ with gr.Blocks(css=css) as app:
|
|
366 |
vid_btn.click(video_clip,[choose_prog,fps,qual,model_name,denoise_strength,face_enhance,outscale],[gif_show,gif_file,vid_stat])
|
367 |
|
368 |
trim_btn.click(trim_vid,[hid_box,start_f,end_f],[out_trim,trim_count])
|
369 |
-
outp_vid.change(load_video,outp_vid,[frame_count,fps,end_f,hid_box
|
370 |
go_btn.click(dl,[inp_url,outp_vid],[outp_vid,outp_file,out_trim,hid_box,hid_fps])
|
371 |
app.load(fn=predict, inputs=[text_input,url_params], outputs=[text_output,text_input],_js=load_js)
|
372 |
app.launch(show_api=False)
|
|
|
37 |
minutes = int(vid_t/60)-(hours*360)
|
38 |
seconds = vid_t-(minutes*60)-(hours*360)
|
39 |
vid_len = f'{hours}:{minutes}:{seconds}'
|
40 |
+
return frame_count, fps, vid_len, vid
|
|
|
|
|
|
|
|
|
41 |
def im_2_vid(images,fps):
|
42 |
this_im=cv2.imread(images[0])
|
43 |
height=this_im.shape[0]
|
|
|
250 |
outp_img=gr.Image(label="Enhanced Image")
|
251 |
with gr.Box(visible=False) as vid_box:
|
252 |
with gr.Group():
|
|
|
253 |
inp_url = gr.Textbox(label="Video URL")
|
254 |
go_btn = gr.Button("Run")
|
255 |
outp_vid=gr.Video(format="mp4")
|
|
|
267 |
out_trim=gr.Video(format="mp4")
|
268 |
hid_box = gr.Textbox(visible=True)
|
269 |
hid_fps = gr.Textbox(visible=True)
|
270 |
+
|
|
|
271 |
with gr.Row():
|
272 |
qual=gr.Checkbox(label="Improve Quality (slow)",value=False)
|
273 |
with gr.Accordion("Quality Options", open=False):
|
|
|
288 |
samp_btn=gr.Button("Get Sample")
|
289 |
samp_im = gr.Image(label="Sample Frame")
|
290 |
|
291 |
+
|
292 |
+
with gr.Column(visible=False) as gif_row:
|
293 |
+
with gr.Row():
|
294 |
+
choose_prog=gr.Radio(label="GIF Engine",choices=['imageio','ImageMagick','ffmpeg'], value = "imageio")
|
295 |
+
with gr.Row():
|
296 |
+
gif_btn = gr.Button("Make GIF")
|
297 |
+
gif_stat=gr.Textbox(label="Status")
|
298 |
with gr.Row(visible=False) as vid_row:
|
299 |
vid_btn = gr.Button("Make Video")
|
300 |
vid_stat=gr.Textbox(label="Status")
|
|
|
364 |
vid_btn.click(video_clip,[choose_prog,fps,qual,model_name,denoise_strength,face_enhance,outscale],[gif_show,gif_file,vid_stat])
|
365 |
|
366 |
trim_btn.click(trim_vid,[hid_box,start_f,end_f],[out_trim,trim_count])
|
367 |
+
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,trim_count])
|
368 |
go_btn.click(dl,[inp_url,outp_vid],[outp_vid,outp_file,out_trim,hid_box,hid_fps])
|
369 |
app.load(fn=predict, inputs=[text_input,url_params], outputs=[text_output,text_input],_js=load_js)
|
370 |
app.launch(show_api=False)
|