Spaces:
Build error
Build error
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -2,13 +2,41 @@
|
|
| 2 |
set -euo pipefail
|
| 3 |
mkdir -p model
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
fi
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
|
|
|
| 14 |
python app.py
|
|
|
|
| 2 |
set -euo pipefail
|
| 3 |
mkdir -p model
|
| 4 |
|
| 5 |
+
GGUF_PATH_M="model/llama-joycaption-q4_k_m.gguf"
|
| 6 |
+
GGUF_PATH_S="model/llama-joycaption-q4_k_s.gguf"
|
| 7 |
|
| 8 |
+
GGUF_URL_M="https://huggingface.co/mradermacher/llama-joycaption-beta-one-hf-llava-GGUF/resolve/main/llama-joycaption-beta-one-hf-llava-q4_k_m.gguf"
|
| 9 |
+
GGUF_URL_S="https://huggingface.co/mradermacher/llama-joycaption-beta-one-hf-llava-GGUF/resolve/main/llama-joycaption-beta-one-hf-llava-q4_k_s.gguf"
|
| 10 |
+
|
| 11 |
+
download_model() {
|
| 12 |
+
local url=$1
|
| 13 |
+
local path=$2
|
| 14 |
+
if [ -f "$path" ]; then
|
| 15 |
+
echo "Model already present at $path"
|
| 16 |
+
return 0
|
| 17 |
+
fi
|
| 18 |
+
echo "Downloading $path (may be several GB)..."
|
| 19 |
+
if curl -L -C - -o "$path" "$url"; then
|
| 20 |
+
echo "Downloaded $path"
|
| 21 |
+
return 0
|
| 22 |
+
else
|
| 23 |
+
rm -f "$path"
|
| 24 |
+
return 1
|
| 25 |
+
fi
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
# Try Q4_K_M first
|
| 29 |
+
if download_model "$GGUF_URL_M" "$GGUF_PATH_M"; then
|
| 30 |
+
MODEL_PATH="$GGUF_PATH_M"
|
| 31 |
+
elif download_model "$GGUF_URL_S" "$GGUF_PATH_S"; then
|
| 32 |
+
MODEL_PATH="$GGUF_PATH_S"
|
| 33 |
+
else
|
| 34 |
+
echo "Failed to download both Q4_K_M and Q4_K_S models." >&2
|
| 35 |
+
exit 1
|
| 36 |
fi
|
| 37 |
|
| 38 |
+
# Symlink expected filename used in app.py
|
| 39 |
+
ln -sf "$MODEL_PATH" model/llama-joycaption-q4_k_m.gguf
|
| 40 |
+
|
| 41 |
+
# Run app.py (Spaces runs app.py automatically; this is for local runs)
|
| 42 |
python app.py
|