39 lines
1.5 KiB
Bash
Executable File
39 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$SCRIPT_DIR"
|
|
WHEELHOUSE_DIR="$PROJECT_ROOT/wheelhouse"
|
|
DEEPFACE_SOURCE_DIR="$PROJECT_ROOT/weights/deepface"
|
|
DEEPFACE_TARGET_DIR="${HOME}/.deepface/weights"
|
|
PYTHON_BIN="${PYTHON_BIN:-python3.12}"
|
|
|
|
cd "$PROJECT_ROOT"
|
|
|
|
"$PYTHON_BIN" -m venv .venv
|
|
source .venv/bin/activate
|
|
|
|
if [[ -d "$WHEELHOUSE_DIR" ]] && find "$WHEELHOUSE_DIR" -maxdepth 1 -name '*.whl' | grep -q .; then
|
|
python -m pip install --no-index --find-links "$WHEELHOUSE_DIR" --upgrade pip setuptools wheel
|
|
pip install --no-index --find-links "$WHEELHOUSE_DIR" "numpy<2"
|
|
pip install --no-index --find-links "$WHEELHOUSE_DIR" torch torchvision
|
|
pip install --no-index --find-links "$WHEELHOUSE_DIR" "tensorflow[and-cuda]==2.16.1" "tf-keras==2.16.0"
|
|
pip install --no-index --find-links "$WHEELHOUSE_DIR" -r requirements-native.txt
|
|
else
|
|
python -m pip install --upgrade pip setuptools wheel
|
|
pip install "numpy<2"
|
|
pip install --index-url https://download.pytorch.org/whl/cu126 torch torchvision
|
|
pip install "tensorflow[and-cuda]==2.16.1" "tf-keras==2.16.0"
|
|
pip install -r requirements-native.txt
|
|
fi
|
|
|
|
mkdir -p "$DEEPFACE_TARGET_DIR"
|
|
if find "$DEEPFACE_SOURCE_DIR" -maxdepth 1 -name '*.h5' | grep -q .; then
|
|
cp -f "$DEEPFACE_SOURCE_DIR"/*.h5 "$DEEPFACE_TARGET_DIR"/
|
|
else
|
|
echo "Warning: missing bundled DeepFace weights under $DEEPFACE_SOURCE_DIR"
|
|
echo "Attribute analysis will stay unavailable until the .h5 files are provided."
|
|
fi
|
|
|
|
echo "venv_ready=$PROJECT_ROOT/.venv"
|