2023-01-22 04:34:41 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2023-02-10 04:02:27 +00:00
|
|
|
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
|
|
|
|
|
2023-01-22 04:34:41 +00:00
|
|
|
echo "Downloading and converting models to ONNX format..."
|
2023-02-11 05:06:30 +00:00
|
|
|
python3 -m onnx_web.convert \
|
2023-02-12 15:28:37 +00:00
|
|
|
--sources \
|
2023-02-11 05:06:30 +00:00
|
|
|
--diffusion \
|
|
|
|
--upscaling \
|
|
|
|
--correction \
|
2023-04-22 15:39:39 +00:00
|
|
|
--extras=${ONNX_WEB_EXTRA_MODELS:-../models/extras.json} \
|
2023-03-09 03:38:51 +00:00
|
|
|
--token=${HF_TOKEN:-} \
|
|
|
|
${ONNX_WEB_EXTRA_ARGS:-}
|
2023-01-22 04:34:41 +00:00
|
|
|
|
|
|
|
echo "Launching API server..."
|
2023-04-11 04:21:13 +00:00
|
|
|
waitress-serve \
|
|
|
|
--host=0.0.0.0 \
|
|
|
|
--port=5000 \
|
|
|
|
--call \
|
|
|
|
onnx_web.main:run
|