forked from microsoft/OmniParser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
39 lines (33 loc) · 898 Bytes
/
run.sh
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
#!/bin/bash
# Define the model directory
MODEL_DIR="./weights"
# Function to download model checkpoints
download() {
echo "Downloading model checkpoints to $MODEL_DIR..."
mkdir -p "$MODEL_DIR"
for f in icon_detect/{train_args.yaml,model.pt,model.yaml} \
icon_caption/{config.json,generation_config.json,model.safetensors}; do
conda run --no-capture-output -n omni huggingface-cli download microsoft/OmniParser-v2.0 "$f" --local-dir "$MODEL_DIR"
done
mv "$MODEL_DIR/icon_caption" "$MODEL_DIR/icon_caption_florence"
echo "Download complete."
}
# Function to run the Python script
run() {
echo "Running script with conda environment..."
cd ./omnitool/omniparserserver/
conda run --no-capture-output -n omni python omniparserserver.py
}
# Parse the command-line argument
case "$1" in
dl)
download
;;
run)
run
;;
*)
echo "Usage: $0 {dl|run}"
exit 1
;;
esac