diff --git a/setup.ps1 b/setup.ps1 index 335519c..024d058 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -1,22 +1,32 @@ # Setup script for Windows Write-Host "Setting up Kokoro TTS Local..." -# Check if Python is installed -if (!(Get-Command python -ErrorAction SilentlyContinue)) { - Write-Host "Error: Python is not installed. Please install Python 3.8 or higher." - exit 1 +# Check if uv is installed +$uvExists = Get-Command uv -ErrorAction SilentlyContinue +if (-not $uvExists) { + Write-Host "Installing uv package manager..." + iwr -useb https://astral.sh/uv/install.ps1 | iex } -# Create and activate virtual environment -Write-Host "Creating virtual environment..." -python -m venv venv -.\venv\Scripts\Activate +# Create virtual environment if it doesn't exist +if (-not (Test-Path "venv")) { + Write-Host "Creating virtual environment..." + uv venv +} -# Upgrade pip -python -m pip install --upgrade pip +# Activate virtual environment +Write-Host "Activating virtual environment..." +.\venv\Scripts\Activate.ps1 -# Install dependencies +# Install dependencies using uv Write-Host "Installing dependencies..." -pip install -r requirements.txt +uv pip install -r requirements.txt -Write-Host "Setup complete! You can now run: python tts_demo.py" \ No newline at end of file +# Install FFmpeg if not already installed (using winget) +$ffmpegExists = Get-Command ffmpeg -ErrorAction SilentlyContinue +if (-not $ffmpegExists) { + Write-Host "Installing FFmpeg..." + winget install -e --id Gyan.FFmpeg +} + +Write-Host "Setup complete! Run '.\venv\Scripts\Activate.ps1' to activate the virtual environment." \ No newline at end of file diff --git a/setup.sh b/setup.sh index bd9fb0d..d86435b 100644 --- a/setup.sh +++ b/setup.sh @@ -8,16 +8,33 @@ if ! command -v python3 &> /dev/null; then exit 1 fi -# Create and activate virtual environment -echo "Creating virtual environment..." -python3 -m venv venv +# Install uv if not already installed +if ! command -v uv &> /dev/null; then + echo "Installing uv package manager..." + curl -LsSf https://astral.sh/uv/install.sh | sh +fi + +# Create virtual environment if it doesn't exist +if [ ! -d "venv" ]; then + echo "Creating virtual environment..." + uv venv +fi + +# Activate virtual environment source venv/bin/activate -# Upgrade pip -python -m pip install --upgrade pip - -# Install dependencies +# Install dependencies using uv echo "Installing dependencies..." -pip install -r requirements.txt +uv pip install -r requirements.txt -echo "Setup complete! You can now run: python tts_demo.py" \ No newline at end of file +# Install system dependencies if needed +if [ "$(uname)" == "Linux" ]; then + echo "Installing system dependencies..." + sudo apt-get update + sudo apt-get install -y espeak-ng ffmpeg +elif [ "$(uname)" == "Darwin" ]; then + echo "Installing system dependencies..." + brew install espeak-ng ffmpeg +fi + +echo "Setup complete! Run 'source venv/bin/activate' to activate the virtual environment." \ No newline at end of file