OCR 500: GPU 回退 CPU、返回详细错误、增加 test-ocr 诊断。
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")" && pwd)"
|
||||
PORT="${OCR_PORT:-23567}"
|
||||
TMP="/tmp/ocr-test-$$.jpg"
|
||||
|
||||
if [[ ! -d "${ROOT}/.venv" ]]; then
|
||||
echo "请先 bash install.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "${ROOT}/.venv/bin/activate"
|
||||
python3 -c "from PIL import Image; Image.new('RGB',(200,80),(255,255,255)).save('${TMP}')"
|
||||
|
||||
echo "==> GET /health"
|
||||
curl -sS "http://127.0.0.1:${PORT}/health" || { echo "FAIL: OCR 未启动"; exit 1; }
|
||||
echo ""
|
||||
|
||||
echo "==> POST /api/ocr/regions"
|
||||
curl -sS -w "\nHTTP %{http_code}\n" -F "file=@${TMP};type=image/jpeg" \
|
||||
"http://127.0.0.1:${PORT}/api/ocr/regions"
|
||||
rm -f "${TMP}"
|
||||
Reference in New Issue
Block a user