| # Create Hugging Face Spaces for all templates using Python API | |
| # Prerequisites: | |
| # - huggingface-hub python package installed | |
| # - Logged in to Hugging Face CLI | |
| echo "🤗 Creating Hugging Face Spaces for templates..." | |
| python3 << 'PYTHON_SCRIPT' | |
| from huggingface_hub import HfApi | |
| import sys | |
| api = HfApi() | |
| templates = [ | |
| "devforge", | |
| "mobilefirst", | |
| "saasify", | |
| "startupkit", | |
| "analyticsdash", | |
| "blog", | |
| "changelog", | |
| "portfolio", | |
| "ai-chat", | |
| "search", | |
| "ecommerce", | |
| "api-docs" | |
| ] | |
| for template in templates: | |
| repo_id = f"Hanzo-Community/{template}" | |
| print(f"📦 Creating space: {repo_id}...") | |
| try: | |
| # Create the space | |
| api.create_repo( | |
| repo_id=repo_id, | |
| repo_type="space", | |
| space_sdk="docker", | |
| private=False, | |
| exist_ok=True | |
| ) | |
| print(f" ✅ Created or already exists: {repo_id}") | |
| except Exception as e: | |
| print(f" ⚠️ Error creating {repo_id}: {str(e)}") | |
| print("\n✅ Done! Now you can run ./push-to-huggingface.sh to push templates") | |
| PYTHON_SCRIPT |