File size: 1,448 Bytes
59ca130 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
#!/usr/bin/env bash
download()
{
echo "download $1"
# https://stackoverflow.com/questions/3162385/how-to-split-a-string-in-shell-and-get-the-last-field
fn=${1##*/}
if [ ! -f $fn ] ; then
wget --no-check-certificate $1
fi
}
# https://stackoverflow.com/questions/24628076/convert-multiline-string-to-array
names="https://huggingface.co/InfiniFlow/deepdoc/resolve/main/det.onnx
https://huggingface.co/InfiniFlow/deepdoc/resolve/main/layout.laws.onnx
https://huggingface.co/InfiniFlow/deepdoc/resolve/main/layout.manual.onnx
https://huggingface.co/InfiniFlow/deepdoc/resolve/main/layout.onnx
https://huggingface.co/InfiniFlow/deepdoc/resolve/main/layout.paper.onnx
https://huggingface.co/InfiniFlow/deepdoc/resolve/main/ocr.res
https://huggingface.co/InfiniFlow/deepdoc/resolve/main/rec.onnx
https://huggingface.co/InfiniFlow/deepdoc/resolve/main/tsr.onnx
https://huggingface.co/InfiniFlow/text_concat_xgb_v1.0/resolve/main/updown_concat_xgb.model"
SAVEIFS=$IFS # Save current IFS (Internal Field Separator)
IFS=$'\n' # Change IFS to newline char
names=($names) # split the `names` string into an array by the same name
IFS=$SAVEIFS # Restore original IFS
find . -size 0 | xargs rm -f
# https://stackoverflow.com/questions/15466808/shell-iterate-over-array
for ((i=0; i<${#names[@]}; i+=1)); do
url="${names[$i]}"
download $url
if [ $? != 0 ]; then
exit -1
fi
done
find . -size 0 | xargs rm -f
|