Spaces:
Sleeping
Sleeping
import gradio as gr | |
import zipfile | |
import os | |
current_path = os.getcwd() | |
print("Current path:", current_path) | |
def unzip_file(zip_path, extract_path): | |
with zipfile.ZipFile(zip_path, 'r') as zip_ref: | |
zip_ref.extractall(extract_path) | |
return "File successfully unzipped!" | |
inputs = [ | |
gr.Textbox(label="Zip file"), | |
gr.inputs.Textbox(label="Extract path") | |
] | |
outputs = gr.outputs.Textbox() | |
title = "Zip file unzipping app" | |
description = "This app unzips a zip file to the specified extract path." | |
examples = [["unzip-bot-beta.zip", current_path+"/unzip"]] | |
app = gr.Interface(unzip_file, inputs, outputs, title=title, description=description,examples=examples) | |
app.launch(debug=True) | |