Spaces:
Sleeping
Sleeping
| $ENV:CUDA_PATH = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.6' | |
| $ENV:PYTHON_DIR = "$ENV:USERPROFILE\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0" | |
| $ENV:PYTHON_SCRIPTS_DIR = "$ENV:USERPROFILE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts" | |
| $ENV:FFMPEG_HOME = "$ENV:USERPROFILE\Downloads\ffmpeg-2025-01-08-git-251de1791e-full_build\bin" | |
| $ENV:PHONEMIZER_ESPEAK_HOME = 'C:\Program Files\eSpeak NG' | |
| $ENV:PHONEMIZER_ESPEAK_LIBRARY = "$ENV:PHONEMIZER_ESPEAK_HOME\libespeak-ng.dll" | |
| $ENV:PHONEMIZER_ESPEAK_PATH = "$ENV:PHONEMIZER_ESPEAK_HOME\espeak-ng.exe" | |
| function Test-DirectoryExists | |
| { | |
| param ([string]$DirectoryPath) | |
| if (-Not (Test-Path -Path $DirectoryPath -PathType Container)) | |
| { | |
| # Output an error message | |
| Write-Error "Directory does not exist: $DirectoryPath" | |
| # Exit the script with a non-zero exit code to indicate failure | |
| exit 1 | |
| } | |
| Write-Host "Directory exists: $DirectoryPath" | |
| } | |
| Write-Host "Prepare Ffmpeg" | |
| if ($null -eq (Get-Command ffmpeg -ErrorAction SilentlyContinue)) | |
| { | |
| Test-DirectoryExists -DirectoryPath "$ENV:FFMPEG_HOME" | |
| $ENV:PATH += ";$ENV:FFMPEG_HOME" | |
| } | |
| ffmpeg -version -hide_banner 2>&1 | Select-Object -Index 0 | |
| Write-Host "Prepare Phonemizer" | |
| if ($null -eq (Get-Command espeak-ng -ErrorAction SilentlyContinue)) | |
| { | |
| Test-DirectoryExists -DirectoryPath "$ENV:PHONEMIZER_ESPEAK_HOME" | |
| $ENV:PATH += ";$ENV:PHONEMIZER_ESPEAK_HOME" | |
| } | |
| espeak-ng.exe --version | |
| Write-Host "Prepare Nvidia Cuda" | |
| if ($null -eq (Get-Command nvcc -ErrorAction SilentlyContinue)) | |
| { | |
| Test-DirectoryExists -DirectoryPath "$ENV:CUDA_PATH\bin" | |
| $ENV:PATH += ";$ENV:CUDA_PATH\bin" | |
| } | |
| nvcc --version | |
| Write-Host "Prepare Python" | |
| if ($null -eq (Get-Command python -ErrorAction SilentlyContinue)) | |
| { | |
| Write-Host "Python is not available. Trying to setup Python." | |
| Test-DirectoryExists -DirectoryPath "$ENV:PYTHON_DIR" | |
| Test-DirectoryExists -DirectoryPath "$ENV:PYTHON_SCRIPTS_DIR" | |
| $ENV:PATH += ";$ENV:PYTHON_DIR" | |
| $ENV:PATH += ";$ENV:PYTHON_SCRIPTS_DIR" | |
| } | |
| python --version | |
| Write-Host "Prepare Python Virtual Environment." | |
| if ($env:VIRTUAL_ENV) | |
| { | |
| Write-Host "The script is running inside a Python virtual environment." | |
| } | |
| else | |
| { | |
| Write-Host "The script is not running inside a Python virtual environment." | |
| Write-Host "Initializing Virtual Environment" | |
| $ENV:VENV_DIR = "$PWD\.venv" | |
| if (-Not (Test-Path -Path $ENV:VENV_DIR -PathType Container)) | |
| { | |
| Write-Host "Virtual Environment does not Exist, Creating: $ENV:VENV_DIR" | |
| python -m venv $ENV:VENV_DIR | |
| . $ENV:VENV_DIR\Scripts\Activate.ps1 | |
| } | |
| else | |
| { | |
| Write-Host "Virtual Environment exists: $ENV:VENV_DIR" | |
| . $ENV:VENV_DIR\Scripts\Activate.ps1 | |
| } | |
| } | |