Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from zipfile import ZipFile
|
| 2 |
+
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def upload_file(file_obj):
|
| 7 |
+
files = []
|
| 8 |
+
with ZipFile(file_obj.name) as zfile:
|
| 9 |
+
for zinfo in zfile.infolist():
|
| 10 |
+
files.append(
|
| 11 |
+
{
|
| 12 |
+
"name": zinfo.filename,
|
| 13 |
+
}
|
| 14 |
+
)
|
| 15 |
+
return files
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
demo = gr.Interface(upload_file, "file", "json")
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
demo.launch()
|