first version
This commit is contained in:
32
sam2-backend/run.sh
Executable file
32
sam2-backend/run.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Convenience launcher for the SAM2 backend.
|
||||
# Assumes a venv at ./.venv with requirements.txt + torch + sam2 installed.
|
||||
# See README.md for install steps.
|
||||
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [ -d ".venv" ]; then
|
||||
# shellcheck disable=SC1091
|
||||
source .venv/bin/activate
|
||||
fi
|
||||
|
||||
HOST="${HOST:-0.0.0.0}"
|
||||
PORT="${PORT:-9090}"
|
||||
DEVICE="${DEVICE:-auto}"
|
||||
|
||||
# Privacy: disable HF/transformers telemetry, and (after weights are cached)
|
||||
# refuse any outbound calls to huggingface.co. Inference runs fully local
|
||||
# regardless; these just stop the cosmetic pings on startup.
|
||||
export HF_HUB_DISABLE_TELEMETRY="${HF_HUB_DISABLE_TELEMETRY:-1}"
|
||||
export DO_NOT_TRACK="${DO_NOT_TRACK:-1}"
|
||||
# Flip both OFFLINE flags to 1 once you've done the first `from_pretrained`
|
||||
# and the weights are cached under ~/.cache/huggingface/. Leaving them 0
|
||||
# the first time lets the model download. After that, set them 1 to fully
|
||||
# air-gap and silence the HEAD-request revalidation pings on every startup.
|
||||
# HF_HUB_OFFLINE — used by huggingface_hub
|
||||
# TRANSFORMERS_OFFLINE — used by transformers itself (some legacy paths)
|
||||
export HF_HUB_OFFLINE="${HF_HUB_OFFLINE:-0}"
|
||||
export TRANSFORMERS_OFFLINE="${TRANSFORMERS_OFFLINE:-0}"
|
||||
|
||||
exec python server.py --host "$HOST" --port "$PORT" --device "$DEVICE" "$@"
|
||||
Reference in New Issue
Block a user