from pathlib import Path import gradio as gr css = """.hamburger-button { width: 30px !important; background-color: transparent !important; border: none !important; padding: 0 !important; outline: none !important; }""" def upload_file(filepath): name = Path(filepath).name return [gr.UploadButton(interactive=False, icon='icon4.png',), gr.DownloadButton( value=filepath, interactive=True, icon='icon2.png',)] #label=f"Download {name}", def download_file(): return [gr.UploadButton(interactive=True), gr.DownloadButton(interactive=False, icon='icon1.png',)] with gr.Blocks(css=css, theme=gr.themes.Base(radius_size=gr.themes.sizes.radius_none,)) as demo: tb = gr.Textbox(value = "First upload a file and and then you'll be able download it (but only once!)") with gr.Row(): with gr.Column(scale=1): u = gr.UploadButton(icon='icon3.png', elem_classes="hamburger-button", label="", file_count="single", size='sm') with gr.Column(scale=1): d = gr.DownloadButton( icon='icon1.png', elem_classes="hamburger-button", label="", interactive=False, size='sm') with gr.Column(scale=8): t = gr.Textbox(visible=False, ) u.upload(upload_file, u, [u, d]) d.click(download_file, None, [u, d]) demo.launch()