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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -341,6 +341,10 @@ def blur_image(image, depth, blur_data):
341
  def loadfile(f):
342
  return f
343
 
 
 
 
 
344
 
345
  def select_frame(v, evt: gr.SelectData):
346
  global frame_selected
@@ -514,7 +518,8 @@ with gr.Blocks(css=css, js=js) as demo:
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])
 
341
  def loadfile(f):
342
  return f
343
 
344
+ def switch_dir(f):
345
+ print(f)
346
+ return gr.FileExplorer(root_dir=os.path.realpath(f))
347
+
348
 
349
  def select_frame(v, evt: gr.SelectData):
350
  global frame_selected
 
518
  with gr.Row():
519
  with gr.Column():
520
  input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
521
+ input_file = gr.FileExplorer(elem_id="file_in", glob="*", root_dir="/tmp/gradio/", label="Files")
522
+ input_url.input(switch_dir, inputs=[input_url], outputs=[input_file])
523
  input_video = gr.Video(label="Input Video", format="mp4")
524
  input_url.input(fn=loadfile, inputs=[input_url], outputs=[input_video])
525
  input_file.change(fn=loadfile, inputs=[input_file], outputs=[input_video])