From d8d5bcd92739224a21afc4b1891b6f5d9ac8e22b Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Thu, 9 Feb 2023 22:02:27 -0600 Subject: [PATCH] fix(api): make venv has been loaded in launch script --- api/launch.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/api/launch.sh b/api/launch.sh index 1dd1ca23..3fd5e5a0 100755 --- a/api/launch.sh +++ b/api/launch.sh @@ -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