# compare.sh: turn one PDF into Markdown with Docling, Marker and MinerU, to compare them on your own files.
# Brasspage, Nov 2026. Free to use, no warranty.
#
# One time (Python 3.12, about 7 GB with the models):
#   python3.12 -m venv v-docling && v-docling/bin/pip install docling
#   python3.12 -m venv v-marker && v-marker/bin/pip install marker-pdf
#   python3.12 -m venv v-mineru && v-mineru/bin/pip install mineru
#   v-mineru/bin/mineru-kit models download --tier standard
#
# Run: sh compare.sh file.pdf    Writes out/docling/, out/marker/ and out/mineru.md
set -e
f="$1"
mkdir -p out
time v-docling/bin/docling "$f" --to md --output out/docling
time v-marker/bin/marker_single "$f" --output_dir out/marker

export MINERU_TELEMETRY_DISABLED=1 # MinerU sends usage data unless this is set
m=v-mineru/bin/mineru
$m server start
$m config set parse_server.local.mode managed
$m server restart
until $m server status | grep -q "Local  │ yes"; do sleep 2; done # models load in about 20 s
time $m parse "$f" --pages all --no-marker --force --tier standard -o out/mineru.md
$m server stop # it keeps a copy of each PDF and result in ./blobs/
