freealise commited on
Commit
5e9c0a3
1 Parent(s): 3716786

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -342,8 +342,8 @@ 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):
@@ -517,8 +517,8 @@ with gr.Blocks(css=css, js=js) as demo:
517
 
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])
 
342
  return f
343
 
344
  def switch_dir(f):
345
+ print(f'file path {f}')
346
+ return gr.FileExplorer(root_dir=os.path.dirname(os.path.abspath(f)))
347
 
348
 
349
  def select_frame(v, evt: gr.SelectData):
 
517
 
518
  with gr.Row():
519
  with gr.Column():
520
+ input_url = gr.Textbox(elem_id="url_in", value="./examples/streetview.mp4", label="URL")
521
+ input_file = gr.FileExplorer(elem_id="file_in", glob="*", root_dir="/home/user/app/examples/", 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])