Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,852 Bytes
e0483c8 |
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
#!/usr/bin/env python3
"""
Script to prepare files for Hugging Face Spaces deployment
"""
import os
import shutil
from pathlib import Path
def prepare_deployment():
"""Prepare files for HF Spaces deployment"""
print("Preparing files for Hugging Face Spaces deployment...")
# Create deployment directory
deploy_dir = Path("hf_deployment")
deploy_dir.mkdir(exist_ok=True)
# Copy main files
files_to_copy = [
("requirements_hf.txt", "requirements.txt"),
("packages.txt", "packages.txt"),
("pre_build.py", "pre_build.py"),
("README_HF.md", "README.md"),
]
for src, dst in files_to_copy:
if os.path.exists(src):
shutil.copy2(src, deploy_dir / dst)
print(f"Copied {src} -> {dst}")
else:
print(f"Warning: {src} not found")
# Copy demo directory
if os.path.exists("demo"):
shutil.copytree("demo", deploy_dir / "demo", dirs_exist_ok=True)
print("Copied demo/ directory")
# Copy tools directory
if os.path.exists("tools"):
shutil.copytree("tools", deploy_dir / "tools", dirs_exist_ok=True)
print("Copied tools/ directory")
# Copy other important files if they exist
optional_files = ["setup.py", "LICENSE"]
for file in optional_files:
if os.path.exists(file):
shutil.copy2(file, deploy_dir / file)
print(f"Copied {file}")
print(f"\nDeployment files prepared in '{deploy_dir}' directory")
print("\nNext steps:")
print("1. Create a new Hugging Face Space")
print("2. Upload all files from the 'hf_deployment' directory")
print("3. Select appropriate hardware (A10G or higher recommended)")
print("4. Wait for the space to build and deploy")
return deploy_dir
if __name__ == "__main__":
prepare_deployment()
|