Skip to content

Commit

Permalink
fix(api): make venv has been loaded in launch script
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Feb 10, 2023
1 parent 36d164a commit d8d5bcd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion api/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@

set -eu

if [ -n "${VIRTUAL_ENV+set}" ]; then
echo "Using current virtual env..."
else
if [ -d "onnx_env" ]; then
echo "Loading existing virtual env..."
. onnx_env/bin/activate
else
echo "Creating new virtual env..."
python -m venv onnx_env
. onnx_env/bin/activate
fi
fi

echo "Downloading and converting models to ONNX format..."
python3 -m onnx_web.convert --diffusion --upscaling --correction --extras=./extras.json --token=${HF_TOKEN:-}
python3 -m onnx_web.convert --diffusion --upscaling --correction --extras=extras.json --token=${HF_TOKEN:-}

echo "Launching API server..."
flask --app=onnx_web.serve run --host=0.0.0.0

0 comments on commit d8d5bcd

Please sign in to comment.