2020-08-20 19:57:07 +08:00
|
|
|
from zipfile import ZipFile
|
|
|
|
|
2022-01-21 21:44:12 +08:00
|
|
|
import gradio as gr
|
|
|
|
|
|
|
|
|
2020-08-20 19:57:07 +08:00
|
|
|
def zip_two_files(file1, file2):
|
2022-01-21 21:44:12 +08:00
|
|
|
with ZipFile("tmp.zip", "w") as zipObj:
|
2020-08-20 19:57:07 +08:00
|
|
|
zipObj.write(file1.name, "file1")
|
|
|
|
zipObj.write(file2.name, "file2")
|
|
|
|
return "tmp.zip"
|
|
|
|
|
2022-01-21 21:44:12 +08:00
|
|
|
|
2020-11-11 22:15:53 +08:00
|
|
|
iface = gr.Interface(
|
2022-01-21 21:44:12 +08:00
|
|
|
zip_two_files,
|
|
|
|
["file", "file"],
|
2020-10-29 02:39:28 +08:00
|
|
|
"file",
|
|
|
|
examples=[
|
2021-12-14 14:02:19 +08:00
|
|
|
["files/titanic.csv", "files/titanic.csv"],
|
2022-01-21 21:44:12 +08:00
|
|
|
],
|
2020-10-29 02:39:28 +08:00
|
|
|
)
|
2020-08-28 23:56:03 +08:00
|
|
|
|
2020-11-11 22:15:53 +08:00
|
|
|
if __name__ == "__main__":
|
|
|
|
iface.launch()
|