ragflow/download_deps.sh
Zhichang Yu d8a43416f5
Rework Dockerfile.scratch (#2525)
### What problem does this PR solve?

Rework Dockerfile.scratch
- Multiple stage Dockerfile
- Removed conda
- Replaced pip with poetry
- Added missing dependencies and fixed package version conflicts
- Added deepdoc models

### Type of change

- [x] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
2024-09-23 10:00:44 +08:00

39 lines
1.4 KiB
Bash

#!/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