Spaces:
Sleeping
Sleeping
| import os | |
| import tarfile | |
| from pathlib import Path | |
| # Define paths | |
| PROCESSED_DATA_DIR = Path("processed_data") | |
| TARGET_PACKAGE = "processed_data.tar.gz" | |
| def simple_package(): | |
| """ | |
| Package the processed data into a single compressed file without validation. | |
| This creates a tar.gz file containing the entire processed_data directory. | |
| """ | |
| print("Starting simple packaging process...") | |
| # Check if folder exists | |
| if not os.path.exists(PROCESSED_DATA_DIR): | |
| print(f"ERROR: Directory {PROCESSED_DATA_DIR} not found!") | |
| return | |
| # Create tar.gz file | |
| print(f"Creating package file: {TARGET_PACKAGE}") | |
| with tarfile.open(TARGET_PACKAGE, "w:gz") as tar: | |
| # Add the entire directory | |
| tar.add(PROCESSED_DATA_DIR, arcname=PROCESSED_DATA_DIR.name) | |
| # Verify the tarfile was created | |
| if os.path.exists(TARGET_PACKAGE): | |
| size_mb = os.path.getsize(TARGET_PACKAGE) / (1024 * 1024) | |
| print(f"Package created successfully: {TARGET_PACKAGE} ({size_mb:.2f} MB)") | |
| print("\nInstructions:") | |
| print(f"1. Upload {TARGET_PACKAGE} to your Hugging Face Space") | |
| print("2. The app will automatically extract it on startup") | |
| else: | |
| print("Failed to create package file") | |
| if __name__ == "__main__": | |
| simple_package() |