feat(server): add OCR invoice processing functionality
New endpoints: - server/src/app/api/v1/endpoints/ocr.py: OCR API endpoints for invoice scanning New schemas: - server/src/app/schemas/ocr.py: OCR request/response data schemas New services: - server/src/app/services/ocr.py: OCR processing business logic - server/src/app/services/expense_claims.py: expense claims management service Scripts: - server/scripts/bootstrap_paddleocr_mobile.sh: PaddleOCR mobile setup script - server/scripts/paddle_ocr_worker.py: PaddleOCR worker process
This commit is contained in:
20
server/scripts/bootstrap_paddleocr_mobile.sh
Normal file
20
server/scripts/bootstrap_paddleocr_mobile.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
OCR_VENV_DIR="${ROOT_DIR}/.venv-ocr312"
|
||||
PYTHON_BIN="${PYTHON_BIN:-python3.12}"
|
||||
|
||||
if ! command -v "${PYTHON_BIN}" >/dev/null 2>&1; then
|
||||
echo "python3.12 不存在,请先安装 Python 3.12。" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get install -y libgl1 libglib2.0-0
|
||||
|
||||
"${PYTHON_BIN}" -m venv "${OCR_VENV_DIR}"
|
||||
"${OCR_VENV_DIR}/bin/pip" install --upgrade pip
|
||||
"${OCR_VENV_DIR}/bin/pip" install "paddlepaddle==3.2.0" "paddleocr==3.5.0"
|
||||
|
||||
echo "PaddleOCR mobile runtime 已安装到 ${OCR_VENV_DIR}"
|
||||
Reference in New Issue
Block a user