gallery / create-hf-spaces.sh
Hanzo Dev
Add git submodule architecture for templates with Hugging Face integration
366fe97
#!/bin/bash
# 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