gradio/demo/upload_button/run.py
Dawood Khan b5f22671a2
Add Upload Button (#2591)
* add upload button

* upload button

* changelog

* Update CHANGELOG.md

* format

* update file component

* upload button fixes

* label

* remove fileupload changes

* remove file component changes

* restore lock file

* pnpm lock file

* Update CHANGELOG.md

* fixes

* fixes

* more fixes

* fix tests

* fixes

* lockfile

* fix test

* Update gradio/components.py

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-11-21 13:34:31 -05:00

13 lines
366 B
Python

import gradio as gr
def upload_file(files):
file_paths = [file.name for file in files]
return file_paths
with gr.Blocks() as demo:
file_output = gr.File()
upload_button = gr.UploadButton("Click to Upload a File", file_types=["image", "video"], file_count="multiple")
upload_button.upload(upload_file, upload_button, file_output)
demo.launch()