31 lines
711 B
Bash
31 lines
711 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
cd "$(dirname "$0")"
|
||
|
|
|
||
|
|
export HF_HOME="${HF_HOME:-$PWD/.hf_cache}"
|
||
|
|
export HUGGINGFACE_HUB_CACHE="${HUGGINGFACE_HUB_CACHE:-$HF_HOME/hub}"
|
||
|
|
mkdir -p "$HUGGINGFACE_HUB_CACHE"
|
||
|
|
|
||
|
|
if [ -n "${PYTHON:-}" ]; then
|
||
|
|
python_bin="$PYTHON"
|
||
|
|
elif command -v python3.11 >/dev/null 2>&1; then
|
||
|
|
python_bin="python3.11"
|
||
|
|
elif command -v python3 >/dev/null 2>&1; then
|
||
|
|
python_bin="python3"
|
||
|
|
else
|
||
|
|
echo "Could not find python3.11 or python3. Install Python 3.11, then run this script again." >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ ! -d ".venv" ]; then
|
||
|
|
"$python_bin" -m venv .venv
|
||
|
|
fi
|
||
|
|
|
||
|
|
source .venv/bin/activate
|
||
|
|
|
||
|
|
python -m pip install --upgrade pip
|
||
|
|
python -m pip install -r requirements.txt
|
||
|
|
|
||
|
|
exec python main.py
|