Download separately

This commit is contained in:
MangoPig
2026-02-21 23:07:54 +00:00
parent 6f2d664185
commit 3b52c2ba02
+9 -4
View File
@@ -18,10 +18,15 @@ services:
command:
- |
# Download Chinese OCR models if missing (first run only)
if [ ! -f /opt/app-root/src/.cache/docling/models/EasyOcr/zh_sim_g2.pth ] || [ ! -f /opt/app-root/src/.cache/docling/models/EasyOcr/zh_tra_g2.pth ]; then
echo "Downloading Chinese OCR models (Simplified + Traditional)..."
python3 -c "import easyocr; easyocr.Reader(['en','ch_sim','ch_tra'], gpu=False)"
# Copy downloaded models to correct location
# Note: ch_sim and ch_tra are mutually exclusive, must download separately
if [ ! -f /opt/app-root/src/.cache/docling/models/EasyOcr/zh_sim_g2.pth ]; then
echo "Downloading Simplified Chinese OCR model..."
python3 -c "import easyocr; easyocr.Reader(['en','ch_sim'], gpu=False)"
cp -n /opt/app-root/src/.EasyOCR/model/*.pth /opt/app-root/src/.cache/docling/models/EasyOcr/ 2>/dev/null || true
fi
if [ ! -f /opt/app-root/src/.cache/docling/models/EasyOcr/zh_tra_g2.pth ]; then
echo "Downloading Traditional Chinese OCR model..."
python3 -c "import easyocr; easyocr.Reader(['en','ch_tra'], gpu=False)"
cp -n /opt/app-root/src/.EasyOCR/model/*.pth /opt/app-root/src/.cache/docling/models/EasyOcr/ 2>/dev/null || true
fi
exec uvicorn docling_serve.app:app --host 0.0.0.0 --port 5001