Files
ocr-server/scripts/download-models.sh
T
2026-10-13 13:27:06 +08:00

23 lines
674 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
if [[ ! -f config.yaml ]]; then
printf '%s\n' '[ERROR] 未找到 config.yaml,请从项目根目录运行此脚本。' >&2
exit 1
fi
if command -v uv >/dev/null 2>&1; then
printf '%s\n' '[OCR] 检查并下载缺失模型...'
uv run python scripts/download_models.py
elif [[ -x .venv/bin/python ]]; then
printf '%s\n' '[OCR] 检查并下载缺失模型(使用 .venv)...'
.venv/bin/python scripts/download_models.py
else
printf '%s\n' '[ERROR] 未找到 uv 或 .venv/bin/python,请先安装依赖。' >&2
exit 1
fi
printf '%s\n' '[OCR] 模型已就绪。'