Files
silver_pose/init.ps1
T

35 lines
1.1 KiB
PowerShell
Raw Normal View History

2026-07-20 22:05:55 +08:00
#!/usr/bin/env pwsh
# Silver Pose 的 Windows 统一启动与验证入口。
# 当前阶段验证 demo 基线;T-101 创建 v1 后,应同步更新本文件和 docs/03-tech-stack.md。
$ErrorActionPreference = "Stop"
Set-Location -Path $PSScriptRoot
$InstallCmd = 'python -c "import cv2, numpy, ultralytics, PyQt5; print(''required Python packages available'')"'
$VerifyCmd = "python -m compileall -q demo"
$StartCmd = "Set-Location demo; python main.py"
function Invoke-Checked {
param([string]$Label, [string]$Command)
Write-Host "==> $Label"
Invoke-Expression $Command
if ($LASTEXITCODE -ne 0) {
throw "$Label failed with exit code $LASTEXITCODE"
}
}
Write-Host "==> 当前目录: $($PWD.Path)"
Invoke-Checked -Label "检查 Silver Pose Python 依赖" -Command $InstallCmd
Invoke-Checked -Label "运行 demo 基线验证" -Command $VerifyCmd
Write-Host "==> 图形界面启动命令"
Write-Host " $StartCmd"
if ($env:RUN_START_COMMAND -eq "1") {
Write-Host "==> 启动应用"
Invoke-Expression $StartCmd
} else {
Write-Host "设置 RUN_START_COMMAND=1 后,init.ps1 会启动 GUI。"
}