Repository navigation
Expand file tree
/
Copy pathstart.ps1
More file actions
53 lines (43 loc) · 1.71 KB
/
Copy pathstart.ps1
File metadata and controls
53 lines (43 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<#
.SYNOPSIS
NHS Chatbot Cookbook - PowerLauncher
.DESCRIPTION
Checks environment, installs missing libs, and runs v4 app.
#>
Write-Host "========================================================" -ForegroundColor Cyan
Write-Host " NHS CHATBOT COOKBOOK - AUTOMATED STARTUP" -ForegroundColor Cyan
Write-Host "========================================================"
Write-Host ""
# 1. Check Python Availability
try {
$null = python --version
}
catch {
Write-Error "Python not found! Please install from python.org"
Read-Host "Press Enter to exit..."
exit
}
# 2. Virtual Environment Logic
$venvPath = ".\.venv"
$pythonExe = "$venvPath\Scripts\python.exe"
if (-not (Test-Path $venvPath)) {
Write-Host "[INIT] Creating safe virtual environment (.venv)..." -ForegroundColor Yellow
python -m venv .venv
}
# 3. Dependency Management
# We run pip using the venv python directly. This is safer than 'activating' in scripts.
Write-Host "[INFO] Verifying libraries..." -ForegroundColor Green
& $pythonExe -m pip install -r requirements.txt --quiet --disable-pip-version-check
# 4. Ollama Check
if (-not (Get-Command "ollama" -ErrorAction SilentlyContinue)) {
Write-Warning "Ollama is not installed."
Write-Host "Please download it from https://ollama.com/download" -ForegroundColor Yellow
# We don't exit, we let them try running anyway (e.g. if using remote server)
}
# 5. Launch Application
Write-Host ""
Write-Host "[LAUNCH] Starting 'The Full Monty'..." -ForegroundColor Cyan
Write-Host "Press Ctrl+C to stop." -ForegroundColor Gray
Write-Host ""
& $pythonExe -m streamlit run app_book_v4.py
Read-Host "Application closed. Press Enter to exit..."