mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
9b42ba8f10
* changes * changes * revert changes * changes * add changeset * notebooks script * changes * changes --------- Co-authored-by: Ali Abid <aliabid94@gmail.com> Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
24 lines
657 B
Python
24 lines
657 B
Python
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.dirname(__file__),"files/titanic.csv"),
|
|
os.path.join(os.path.dirname(__file__),"files/titanic.csv"),
|
|
os.path.join(os.path.dirname(__file__),"files/titanic.csv")]]],
|
|
cache_examples=True
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|