| <# | |
| Launch the Gradio app with the repository's local ffmpeg on PATH. | |
| Usage: | |
| powershell.exe -ExecutionPolicy Bypass -File .\scripts\run_app_with_ffmpeg.ps1 | |
| This script will: | |
| - Source scripts\add_ffmpeg_path.ps1 to add local ffmpeg to PATH for this session | |
| - Activate a virtual environment if present at .venv\Scripts\Activate.ps1 (optional) | |
| - Run app.py with the environment variable GOOGLE_API_KEY taken from current environment or .env | |
| #> | |
| $ErrorActionPreference = 'Stop' | |
| # Resolve script and repo paths | |
| $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition | |
| $repoRoot = Resolve-Path (Join-Path $scriptDir "..") | |
| # Add local ffmpeg | |
| & "$scriptDir\add_ffmpeg_path.ps1" | |
| # Optionally activate a venv if present | |
| $venvActivate = Join-Path $repoRoot ".venv\Scripts\Activate.ps1" | |
| if (Test-Path $venvActivate) { | |
| Write-Host "Activating virtual environment at .venv" | |
| & $venvActivate | |
| } | |
| # Ensure .env variables are loaded by Python (dotenv is used in config.py) | |
| # Run the app | |
| Write-Host "Launching app.py (Gradio) on http://localhost:7860" | |
| python "$repoRoot\app.py" | |