Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,25 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
with gr.Row():
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
demo.launch()
|
|
|
1 |
+
from pathlib import Path
|
2 |
import gradio as gr
|
3 |
|
4 |
+
def upload_file(filepath):
|
5 |
+
name = Path(filepath).name
|
6 |
+
return [gr.UploadButton(interactive=False),
|
7 |
+
gr.DownloadButton( value=filepath, interactive=True)] #label=f"Download {name}",
|
8 |
|
9 |
+
def download_file():
|
10 |
+
return [gr.UploadButton(interactive=True), gr.DownloadButton(interactive=False)]
|
11 |
+
|
12 |
+
with gr.Blocks(theme=gr.themes.Base(radius_size=gr.themes.sizes.radius_none)) as demo:
|
13 |
+
tb = gr.Textbox(value = "First upload a file and and then you'll be able download it (but only once!)")
|
14 |
with gr.Row():
|
15 |
+
with gr.Column(scale=1):
|
16 |
+
u = gr.UploadButton(icon='icon4.png', elem_classes="hamburger-button", label="", file_count="single")
|
17 |
+
with gr.Column(scale=1):
|
18 |
+
d = gr.DownloadButton( icon='icon1.png', elem_classes="hamburger-button", label="", interactive=False)
|
19 |
+
with gr.Column(scale=1):
|
20 |
+
t = gr.Textbox(visible=True, )
|
21 |
+
|
22 |
+
u.upload(upload_file, u, [u, d])
|
23 |
+
d.click(download_file, None, [u, d])
|
24 |
|
25 |
+
demo.launch()
|