freealise commited on
Commit
3aacdf3
1 Parent(s): 17bb681

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -339,7 +339,7 @@ def blur_image(image, depth, blur_data):
339
  return blur_frame
340
 
341
  def loadfile(f):
342
- return f, "./examples/streetview.mp4"
343
 
344
 
345
  def select_frame(v, evt: gr.SelectData):
@@ -513,9 +513,11 @@ with gr.Blocks(css=css, js=js) as demo:
513
 
514
  with gr.Row():
515
  with gr.Column():
516
- input_file = gr.Textbox(elem_id="file_in", value="./examples/streetview.mp4", label="URL")
 
517
  input_video = gr.Video(label="Input Video", format="mp4")
518
- input_file.input(fn=loadfile, inputs=[input_file], outputs=[input_video, input_file])
 
519
  output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, type="numpy")
520
  output_switch = gr.Checkbox(label="Show depths")
521
  output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])
 
339
  return blur_frame
340
 
341
  def loadfile(f):
342
+ return f
343
 
344
 
345
  def select_frame(v, evt: gr.SelectData):
 
513
 
514
  with gr.Row():
515
  with gr.Column():
516
+ input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
517
+ input_file = gr.FileExplorer(elem_id="file_in", glob="*.mp4", root_dir="/tmp/gradio/", label="Files")
518
  input_video = gr.Video(label="Input Video", format="mp4")
519
+ input_url.input(fn=loadfile, inputs=[input_url], outputs=[input_video])
520
+ input_file.change(fn=loadfile, inputs=[input_file], outputs=[input_video])
521
  output_frame = gr.Gallery(label="Frames", preview=True, columns=8192, type="numpy")
522
  output_switch = gr.Checkbox(label="Show depths")
523
  output_switch.input(fn=switch_rows, inputs=[output_switch], outputs=[output_frame])