Spaces:
Sleeping
Sleeping
File size: 1,316 Bytes
ece2d3a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 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() |