OCR Worker 改用 RapidOCR/ONNX,修复 Paddle SIGILL。

This commit is contained in:
dekun
2026-06-28 15:27:59 +08:00
parent 035b65dcc8
commit 4de460c235
5 changed files with 34 additions and 108 deletions
+6 -10
View File
@@ -36,11 +36,9 @@ install_ocr_worker() {
log_error "未找到 ${worker_dir}"
return 1
fi
log_info "安装/更新 OCR Worker (PaddleOCR)…"
log_info "安装/更新 OCR Worker (RapidOCR/ONNX)…"
chmod +x "${worker_dir}"/*.sh 2>/dev/null || true
local use_gpu
use_gpu="$(detect_ocr_use_gpu)"
OCR_PORT="${OCR_PORT}" OCR_USE_GPU="${use_gpu}" bash "${worker_dir}/install.sh"
OCR_PORT="${OCR_PORT}" bash "${worker_dir}/install.sh"
}
ocr_screen_running() {
@@ -48,7 +46,7 @@ ocr_screen_running() {
}
start_ocr_screen() {
local worker_dir
local worker_dir log_file
worker_dir="$(ocr_worker_dir)"
if [[ ! -x "${worker_dir}/.venv/bin/uvicorn" ]]; then
log_warn "OCR Worker 未安装,跳过 screen 启动"
@@ -59,20 +57,18 @@ start_ocr_screen() {
return 1
fi
local use_gpu log_file
use_gpu="$(detect_ocr_use_gpu)"
log_info "启动 OCR Worker → screen「${OCR_SCREEN_NAME}」(GPU=${use_gpu}, 端口 ${OCR_PORT})"
log_info "启动 OCR Worker → screen「${OCR_SCREEN_NAME}」(RapidOCR, 端口 ${OCR_PORT})"
if ocr_screen_running; then
screen -S "${OCR_SCREEN_NAME}" -X quit 2>/dev/null || true
sleep 1
fi
mkdir -p "${INSTALL_DIR}/logs" 2>/dev/null || true
local log_file="${INSTALL_DIR}/logs/ocr-worker.log"
log_file="${INSTALL_DIR}/logs/ocr-worker.log"
screen -dmS "${OCR_SCREEN_NAME}" bash -c "
cd '${worker_dir}' &&
export OCR_USE_GPU='${use_gpu}' OCR_PORT='${OCR_PORT}' OCR_HOST=0.0.0.0 &&
export OCR_PORT='${OCR_PORT}' OCR_HOST=0.0.0.0 &&
exec bash run.sh >> '${log_file}' 2>&1
"
sleep 2