Spaces:
Runtime error
Runtime error
| # EmoVoice Hugging Face Space Deployment Script | |
| # This script helps you deploy the EmoVoice demo to Hugging Face Spaces | |
| echo "π EmoVoice Hugging Face Space Deployment" | |
| echo "========================================" | |
| # Check if git is available | |
| if ! command -v git &> /dev/null; then | |
| echo "β Git is not installed or not in PATH" | |
| exit 1 | |
| fi | |
| # Check if huggingface_hub is installed | |
| if ! python -c "import huggingface_hub" 2>/dev/null; then | |
| echo "β οΈ huggingface_hub not found. Installing..." | |
| pip install huggingface_hub | |
| fi | |
| # Get space name from user | |
| echo "" | |
| read -p "Enter your Hugging Face username: " HF_USERNAME | |
| read -p "Enter your space name (e.g., emovoice-demo): " SPACE_NAME | |
| if [ -z "$HF_USERNAME" ] || [ -z "$SPACE_NAME" ]; then | |
| echo "β Username and space name are required" | |
| exit 1 | |
| fi | |
| SPACE_ID="${HF_USERNAME}/${SPACE_NAME}" | |
| echo "" | |
| echo "π Deploying to: https://huggingface.co/spaces/${SPACE_ID}" | |
| echo "" | |
| # Initialize git repository if not already initialized | |
| if [ ! -d ".git" ]; then | |
| echo "π¦ Initializing git repository..." | |
| git init | |
| git add . | |
| git commit -m "Initial commit: EmoVoice demo" | |
| fi | |
| # Add Hugging Face remote | |
| echo "π Adding Hugging Face remote..." | |
| git remote remove origin 2>/dev/null || true | |
| git remote add origin "https://huggingface.co/spaces/${SPACE_ID}" | |
| # Create space on Hugging Face if it doesn't exist | |
| echo "ποΈ Creating Hugging Face Space..." | |
| python -c " | |
| from huggingface_hub import create_repo | |
| try: | |
| create_repo( | |
| repo_id='${SPACE_ID}', | |
| repo_type='space', | |
| space_sdk='gradio', | |
| space_hardware='gpu-t4-small', | |
| private=False | |
| ) | |
| print('β Space created successfully!') | |
| except Exception as e: | |
| if 'already exists' in str(e): | |
| print('βΉοΈ Space already exists, continuing...') | |
| else: | |
| print(f'β Error creating space: {e}') | |
| exit(1) | |
| " | |
| # Push to Hugging Face | |
| echo "π€ Pushing to Hugging Face..." | |
| git push origin main | |
| echo "" | |
| echo "β Deployment completed!" | |
| echo "π Your demo is available at: https://huggingface.co/spaces/${SPACE_ID}" | |
| echo "" | |
| echo "π Next steps:" | |
| echo "1. Wait for the space to build (this may take 5-10 minutes)" | |
| echo "2. Check the logs in the Hugging Face Space interface" | |
| echo "3. Test your demo once it's ready" | |
| echo "" | |
| echo "π§ If you need to update the space, run this script again" | |