mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
16 lines
425 B
Python
16 lines
425 B
Python
|
import gradio as gr
|
||
|
from zipfile import ZipFile
|
||
|
|
||
|
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
|
||
|
|
||
|
gr.Interface(zip_to_json, "file", "json").launch()
|