gradio/demo/zip_two_files.py
2020-08-21 16:17:11 -07:00

12 lines
326 B
Python

# Demo: (File, File) -> (File)
import gradio as gr
from zipfile import ZipFile
def zip_two_files(file1, file2):
with ZipFile('tmp.zip', 'w') as zipObj:
zipObj.write(file1.name, "file1")
zipObj.write(file2.name, "file2")
return "tmp.zip"
gr.Interface(zip_two_files, ["file", "file"], "file").launch()