2023-04-12 01:05:07 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-04-17 14:57:44 -07:00
|
|
|
set -e
|
|
|
|
|
2023-06-29 10:31:01 -07:00
|
|
|
if [ -z "$UNS_API_KEY" ]; then
|
|
|
|
echo "Skipping ingest test against api because the UNS_API_KEY env var is not set."
|
|
|
|
exit 0
|
|
|
|
fi
|
2023-04-12 01:05:07 -04:00
|
|
|
|
2023-06-29 10:31:01 -07:00
|
|
|
PYTHONPATH=. ./unstructured/ingest/main.py \
|
|
|
|
--api-key "$UNS_API_KEY" \
|
|
|
|
--local-input-path example-docs \
|
|
|
|
--local-file-glob "*.pdf" \
|
|
|
|
--structured-output-dir api-ingest-output \
|
|
|
|
--partition-by-api \
|
|
|
|
--partition-strategy hi_res \
|
|
|
|
--verbose \
|
|
|
|
--reprocess
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
|
|
|
if [ "$(find 'api-ingest-output' -type f -printf '.' | wc -c)" != 8 ]; then
|
|
|
|
echo
|
|
|
|
echo "8 files should have been created."
|
|
|
|
exit 1
|
|
|
|
fi
|