#!/usr/bin/env bash # Hugging Face Spaces: install vendored custom Ultralytics before app starts. set -euo pipefail cd "$(dirname "$0")" # HF base image may install huggingface_hub 1.x; Gradio 4.x needs <1.0 (HfFolder) pip install -q "huggingface_hub>=0.23.0,<1.0" export YOLO_CONFIG_DIR="${YOLO_CONFIG_DIR:-/tmp/Ultralytics}" mkdir -p "${YOLO_CONFIG_DIR}" if [[ -d vendor ]]; then pip install -q -e ./vendor echo "Installed custom ultralytics from ./vendor" else echo "WARN: vendor/ missing — run prepare_space.sh before deploying" fi