mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-27 02:30:17 +08:00
cc0cff893f
- black formatting - isort formatting
23 lines
519 B
Python
23 lines
519 B
Python
from zipfile import ZipFile
|
|
|
|
import gradio as gr
|
|
|
|
|
|
def zip_to_json(file_obj):
|
|
files = []
|
|
with ZipFile(file_obj.name) as zfile:
|
|
for zinfo in zfile.infolist():
|
|
files.append(
|
|
{
|
|
"name": zinfo.filename,
|
|
"file_size": zinfo.file_size,
|
|
"compressed_size": zinfo.compress_size,
|
|
}
|
|
)
|
|
return files
|
|
|
|
|
|
iface = gr.Interface(zip_to_json, "file", "json")
|
|
if __name__ == "__main__":
|
|
iface.launch()
|