47 lines
1.3 KiB
PowerShell
47 lines
1.3 KiB
PowerShell
param(
|
|
[switch]$Clean
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$ProjectRoot = Split-Path -Parent $PSScriptRoot
|
|
Set-Location $ProjectRoot
|
|
|
|
if ($Clean) {
|
|
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue build, dist
|
|
}
|
|
|
|
uv sync --dev
|
|
uv run pyinstaller --noconfirm --clean --onedir --name ocr-server `
|
|
--paths src `
|
|
--collect-all paddleocr `
|
|
--collect-all paddlex `
|
|
--collect-all paddle `
|
|
--collect-all cv2 `
|
|
--collect-all PIL `
|
|
--collect-all pyclipper `
|
|
--collect-all pypdfium2 `
|
|
--collect-all shapely `
|
|
--collect-all bidi `
|
|
--hidden-import paddlex.inference.models.text_detection.processors `
|
|
--copy-metadata paddlex `
|
|
--copy-metadata paddleocr `
|
|
--copy-metadata paddlepaddle `
|
|
--copy-metadata imagesize `
|
|
--add-data "config.yaml;." `
|
|
--add-data "http;http" `
|
|
--add-data "scripts;_packaging_scripts" `
|
|
--additional-hooks-dir scripts `
|
|
--hidden-import imagesize `
|
|
--hidden-import imagesize.imagesize `
|
|
--hidden-import ocr_server.app `
|
|
--hidden-import ocr_server.config `
|
|
scripts/packaged_entry.py
|
|
|
|
Copy-Item -Force config.yaml dist/ocr-server/config.yaml
|
|
if (Test-Path models) {
|
|
Copy-Item -Recurse -Force models dist/ocr-server/models
|
|
}
|
|
|
|
Write-Host "Windows 发布目录:$ProjectRoot\dist\ocr-server"
|
|
Write-Host "启动:dist\ocr-server\ocr-server.exe"
|