xpvwklvjp commited on
Commit
bdc0c73
·
verified ·
1 Parent(s): 0f5e4b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -1,13 +1,10 @@
1
  import gradio as gr
2
- from pathlib import Path
3
 
4
- current_file_path = Path(__file__).resolve()
5
- relative_path = "path/to/file"
6
- absolute_path = (current_file_path.parent / ".." / ".." / "gradio").resolve()
7
 
8
  def get_file_content(file):
9
  return (file,)
10
 
 
11
  with gr.Blocks() as demo:
12
  gr.Markdown("---")
13
  gr.Markdown('### `FileExplorer` to `Code` -- `file_count="single"`')
@@ -23,5 +20,19 @@ with gr.Blocks() as demo:
23
 
24
  file_3.change(get_file_content, file_3, code)
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  if __name__ == "__main__":
27
- demo.launch()
 
1
  import gradio as gr
 
2
 
 
 
 
3
 
4
  def get_file_content(file):
5
  return (file,)
6
 
7
+
8
  with gr.Blocks() as demo:
9
  gr.Markdown("---")
10
  gr.Markdown('### `FileExplorer` to `Code` -- `file_count="single"`')
 
20
 
21
  file_3.change(get_file_content, file_3, code)
22
 
23
+ gr.Markdown("---")
24
+ gr.Markdown('### `FileExplorer` to `Image` -- `file_count="single"`')
25
+ with gr.Group():
26
+ with gr.Row():
27
+ file_4 = gr.FileExplorer(
28
+ scale=1,
29
+ file_count="single",
30
+ elem_id="file",
31
+ )
32
+
33
+ img = gr.Image(scale=2)
34
+
35
+ file_4.change(get_file_content, file_3, img)
36
+
37
  if __name__ == "__main__":
38
+ demo.launch()