#!/bin/bash # 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"