Spaces:
Runtime error
Runtime error
| import os | |
| import zipfile | |
| from huggingface_hub import cached_download | |
| # Specify the Google Drive link to the archive file | |
| archive_url = 'https://drive.google.com/uc?id=14QhofCbby053kWbVeWEBHCxOROQS-bjN' | |
| # Specify the destination directory within the Hugging Face space | |
| destination_dir = 'SaviAnna/PicturesText' # Replace with your desired destination directory | |
| # Create the destination directory if it doesn't exist | |
| os.makedirs(destination_dir, exist_ok=True) | |
| # Download the archive to the destination directory | |
| #cached_download(archive_url, destination_dir) | |
| #archive_file = hf_hub_download(url=archive_url, destination=destination_dir) | |
| # Extract the archive | |
| archive_file = os.path.join(destination_dir, 'archive.zip') | |
| cached_download(archive_url) | |
| extracted_directory = os.path.join(destination_dir, 'find_pic') | |
| with zipfile.ZipFile(archive_file, 'r') as zip_ref: | |
| zip_ref.extractall(extracted_directory) | |
| print(f"Archive extracted to: {extracted_directory}") | |