feat(docling): add Chinese OCR support (simplified + traditional)
- Add entrypoint script to auto-download OCR models on first run - Include ch_sim (Simplified) and ch_tra (Traditional) for HK law firm use - Add docling_models volume for model persistence - Bump start_period to 120s for first-run download time
This commit is contained in:
@@ -3,20 +3,34 @@ services:
|
|||||||
docling:
|
docling:
|
||||||
# https://github.com/docling-project/docling-serve
|
# https://github.com/docling-project/docling-serve
|
||||||
# 5001: Web UI + API
|
# 5001: Web UI + API
|
||||||
|
# OCR: EasyOCR with English + Chinese Simplified + Traditional (auto-downloaded on first run)
|
||||||
|
|
||||||
image: ghcr.io/docling-project/docling-serve-cpu:v1.13.0
|
image: ghcr.io/docling-project/docling-serve-cpu:v1.13.0
|
||||||
container_name: jt-docling
|
container_name: jt-docling
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
DOCLING_SERVE_ENABLE_UI: "true"
|
DOCLING_SERVE_ENABLE_UI: "true"
|
||||||
|
volumes:
|
||||||
|
- docling_models:/opt/app-root/src/.cache/docling/models
|
||||||
ports:
|
ports:
|
||||||
- "5001:5001"
|
- "5001:5001"
|
||||||
|
entrypoint: ["/bin/sh", "-c"]
|
||||||
|
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
|
||||||
|
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
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-sf", "http://localhost:5001/health"]
|
test: ["CMD", "curl", "-sf", "http://localhost:5001/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 60s
|
start_period: 120s
|
||||||
|
|
||||||
# Ollama
|
# Ollama
|
||||||
ollama:
|
ollama:
|
||||||
@@ -55,5 +69,7 @@ services:
|
|||||||
# retries: 3
|
# retries: 3
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
docling_models:
|
||||||
|
name: jt-docling-models
|
||||||
ollama_data:
|
ollama_data:
|
||||||
name: jt-ollama-data
|
name: jt-ollama-data
|
||||||
|
|||||||
Reference in New Issue
Block a user