File size: 1,501 Bytes
e59bd9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# LPU AI Accelerator V7 — desktop .exe build (optional, one command)

# Produces dist\LPUAccelerator.exe: a standalone NATIVE window app
# (WebView2). No browser window, no Python install needed to run it.

$ErrorActionPreference = "Stop"
$here  = Split-Path -Parent $MyInvocation.MyCommand.Path
$root  = Split-Path -Parent $here
$venv  = "$root\.venv-build"
$py    = "$venv\Scripts\python.exe"

Write-Host "== 1/3 build venv (pyinstaller + pywebview) =="
& "C:\Ipara.co\Scripts\python.exe" -m venv $venv
& $py -m pip install --upgrade pip | Out-Null
& $py -m pip install -r "$root\requirements.txt"
& $py -m pip install pyinstaller pywebview
if ($LASTEXITCODE -ne 0) { throw "deps failed" }

Write-Host "== 2/3 freeze the desktop app =="
& $py -m PyInstaller --noconfirm --clean --onefile --windowed `
    --name "LPUAccelerator" `
    --add-data "$root\frontend\dashboard.html;frontend" `
    --add-data "$root\configs\lpu_config_v7.yaml;configs" `
    --hidden-import uvicorn.logging `
    --hidden-import uvicorn.loops.auto `
    --hidden-import uvicorn.protocols.http.auto `
    --hidden-import uvicorn.protocols.websockets.auto `
    --hidden-import uvicorn.lifespan.on `
    "$root\run_lpu_desktop.py"
if ($LASTEXITCODE -ne 0) { throw "pyinstaller failed" }

Write-Host "== 3/3 done =="
Write-Host "EXE       : $root\dist\LPUAccelerator.exe"
Write-Host "First run : creates %LOCALAPPDATA%\LPU (state, DB, logs)"
Write-Host "Close X   : stops ONLY the accelerator - training is never touched"