diff --git a/api/Containerfile.cpu.buster b/api/Containerfile.cpu.buster index c19cedb6..1d256198 100644 --- a/api/Containerfile.cpu.buster +++ b/api/Containerfile.cpu.buster @@ -22,10 +22,12 @@ RUN pip3 install -r requirements.txt --no-cache-dir COPY onnx_web/ /onnx-web/api/onnx_web/ +COPY launch.sh /onnx-web/launch.sh + COPY params.json /onnx-web/api/params.json ENV ONNX_WEB_BUNDLE_PATH="/onnx-web/gui" COPY gui/ /onnx-web/gui/ -CMD [ "sh", "-c", "python -m onnx_web.convert --diffusion --upscaling --correction --extras && flask --app=onnx_web.serve run --host=0.0.0.0" ] +CMD [ "sh", "-c", "/onnx-web/launch.sh" ] diff --git a/api/Containerfile.cuda.ubuntu b/api/Containerfile.cuda.ubuntu index c80fa99e..6b1f6afd 100644 --- a/api/Containerfile.cuda.ubuntu +++ b/api/Containerfile.cuda.ubuntu @@ -26,10 +26,12 @@ RUN pip3 install onnxruntime-gpu --no-cache-dir COPY onnx_web/ /onnx-web/api/onnx_web/ +COPY launch.sh /onnx-web/launch.sh + COPY params.json /onnx-web/api/params.json ENV ONNX_WEB_BUNDLE_PATH="/onnx-web/gui" COPY gui/ /onnx-web/gui/ -CMD [ "sh", "-c", "python -m onnx_web.convert --diffusion --upscaling --correction --extras && flask --app=onnx_web.serve run --host=0.0.0.0" ] +CMD [ "sh", "-c", "/onnx-web/launch.sh" ] diff --git a/api/Containerfile.directml.buster b/api/Containerfile.directml.buster index b27a4328..14349fb8 100644 --- a/api/Containerfile.directml.buster +++ b/api/Containerfile.directml.buster @@ -22,10 +22,12 @@ RUN pip3 install -r requirements.txt --no-cache-dir COPY onnx_web/ /onnx-web/api/onnx_web/ +COPY launch.sh /onnx-web/launch.sh + COPY params.json /onnx-web/api/params.json ENV ONNX_WEB_BUNDLE_PATH="/onnx-web/gui" COPY gui/ /onnx-web/gui/ -CMD [ "sh", "-c", "python -m onnx_web.convert --diffusion --upscaling --correction --extras && flask --app=onnx_web.serve run --host=0.0.0.0" ] +CMD [ "sh", "-c", "/onnx-web/launch.sh" ] diff --git a/api/Containerfile.rocm.ubuntu b/api/Containerfile.rocm.ubuntu index 1d7dbb0a..348571a2 100644 --- a/api/Containerfile.rocm.ubuntu +++ b/api/Containerfile.rocm.ubuntu @@ -20,10 +20,12 @@ RUN pip3 install -r requirements.txt --no-cache-dir COPY onnx_web/ /onnx-web/api/onnx_web/ +COPY launch.sh /onnx-web/launch.sh + COPY params.json /onnx-web/api/params.json ENV ONNX_WEB_BUNDLE_PATH="/onnx-web/gui" COPY gui/ /onnx-web/gui/ -CMD [ "sh", "-c", "python -m onnx_web.convert --diffusion --upscaling --correction --extras && flask --app=onnx_web.serve run --host=0.0.0.0" ] +CMD [ "sh", "-c", "/onnx-web/launch.sh" ] diff --git a/api/launch.sh b/api/launch.sh new file mode 100755 index 00000000..75b476c9 --- /dev/null +++ b/api/launch.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +set -eu + +echo "Downloading and converting models to ONNX format..." +python3 -m onnx_web.convert --diffusion --upscaling --correction --extras --token=${HF_TOKEN:-} + +echo "Launching API server..." +flask --app=onnx_web.serve run --host=0.0.0.0