|
import gradio as gr |
|
import zipfile |
|
import os |
|
import time |
|
|
|
|
|
ZIP_FILE_PATH = "ipv4/IP2PROXY-LITE-PX2.BIN.zip" |
|
EXTRACT_FOLDER = "ipv4/" |
|
os.makedirs(EXTRACT_FOLDER, exist_ok=True) |
|
|
|
|
|
def extract_zip(): |
|
if not os.path.exists(ZIP_FILE_PATH): |
|
return f"β ZIP file not found: {ZIP_FILE_PATH}" |
|
|
|
with zipfile.ZipFile(ZIP_FILE_PATH, 'r') as zip_ref: |
|
files = zip_ref.namelist() |
|
total_files = len(files) |
|
|
|
for i, file in enumerate(files): |
|
zip_ref.extract(file, EXTRACT_FOLDER) |
|
time.sleep(0.1) |
|
|
|
return f"β
Extracted to {EXTRACT_FOLDER}" |
|
|
|
|
|
iface = gr.Interface( |
|
fn=extract_zip, |
|
inputs=[], |
|
outputs="text", |
|
live=True, |
|
title="ZIP Extractor", |
|
description="Click the button to extract a ZIP file." |
|
) |
|
|
|
iface.launch() |