import streamlit as st import zipfile import os # Function to unzip the 'cspc_db.zip' file and save it in the 'cspc_db' folder def unzip_file(zip_file_path, extract_to_path): # Check if the destination directory exists, and if not, create it if not os.path.exists(extract_to_path): os.makedirs(extract_to_path) # Unzip the file with zipfile.ZipFile(zip_file_path, 'r') as zip_ref: zip_ref.extractall(extract_to_path) st.success(f"Files have been extracted to: {extract_to_path}") # Define the path for the zip file and the extraction folder zip_file_path = "cspc_db.zip" extract_to_path = "cspc_db" # Add a button to trigger the unzip process if st.button('Unzip CSPC Database'): unzip_file(zip_file_path, extract_to_path) st.write(f"Unzipped files are available in the '{extract_to_path}' folder.")