File size: 596 Bytes
8e31597 0da432a 8e31597 0da432a 8e31597 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from pathlib import Path
base_root = Path(__file__).parent.resolve()
with gr.Blocks() as demo:
dd = gr.Dropdown(
label="Select File Explorer Root",
value=str(base_root / "dir1"),
choices=[str(base_root / "dir1"), str(base_root / "dir2")],
)
fe = gr.FileExplorer(root=str(base_root / "dir1"), interactive=True)
dd.select(lambda s: gr.FileExplorer(root=s), inputs=[dd], outputs=[fe])
with gr.Row():
a = gr.Textbox(elem_id="input-box")
a.change(lambda x: x, inputs=[a])
if __name__ == "__main__":
demo.launch() |