Spaces:
Sleeping
Sleeping
imseldrith
commited on
Commit
·
412752b
1
Parent(s):
3c02b39
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import zipfile
|
3 |
+
|
4 |
+
def unzip_file(zip_path, extract_path):
|
5 |
+
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
6 |
+
zip_ref.extractall(extract_path)
|
7 |
+
return "File successfully unzipped!"
|
8 |
+
|
9 |
+
inputs = [
|
10 |
+
gr.inputs.Filepath(label="Zip file"),
|
11 |
+
gr.inputs.Textbox(label="Extract path")
|
12 |
+
]
|
13 |
+
|
14 |
+
outputs = gr.outputs.Textbox()
|
15 |
+
|
16 |
+
title = "Zip file unzipping app"
|
17 |
+
description = "This app unzips a zip file to the specified extract path."
|
18 |
+
#examples = [["example.zip", "/path/to/extract"]]
|
19 |
+
|
20 |
+
app = gr.Interface(unzip_file, inputs, outputs, title=title, description=description, examples=examples)
|
21 |
+
|
22 |
+
app.launch()
|