mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-09 02:00:44 +08:00
921716f618
* fixed visibility error in notebooks in github * Delete fixNotebooks.py deleted script used to fix notebooks * Update generate_notebooks.py fixed a small bug that prevented visibility of notebooks in GitHub
1.6 KiB
1.6 KiB
Gradio Demo: zip_files¶
In [ ]:
!pip install -q gradio
In [ ]:
# Downloading files from the demo repo import os os.mkdir('files') !wget -q -O files/titanic.csv https://github.com/gradio-app/gradio/raw/main/demo/zip_files/files/titanic.csv
In [ ]:
import os from zipfile import ZipFile import gradio as gr def zip_files(files): with ZipFile("tmp.zip", "w") as zipObj: for idx, file in enumerate(files): zipObj.write(file.name, file.name.split("/")[-1]) return "tmp.zip" demo = gr.Interface( zip_files, gr.File(file_count="multiple", file_types=["text", ".json", ".csv"]), "file", examples=[[[os.path.join(os.path.abspath(''),"files/titanic.csv"), os.path.join(os.path.abspath(''),"files/titanic.csv"), os.path.join(os.path.abspath(''),"files/titanic.csv")]]], cache_examples=True ) if __name__ == "__main__": demo.launch()