diff --git a/api/launch.bat b/api/launch.bat index 0d5933e5..680de5d9 100644 --- a/api/launch.bat +++ b/api/launch.bat @@ -1,5 +1,7 @@ call onnx_env\Scripts\Activate.bat +echo "This launch.bat script is deprecated in favor of launch.ps1 and will be removed in a future release." + echo "Downloading and converting models to ONNX format..." IF "%ONNX_WEB_EXTRA_MODELS%"=="" (set ONNX_WEB_EXTRA_MODELS=..\models\extras.json) python -m onnx_web.convert ^ @@ -10,6 +12,12 @@ python -m onnx_web.convert ^ --extras=%ONNX_WEB_EXTRA_MODELS% ^ --token=%HF_TOKEN% %ONNX_WEB_EXTRA_ARGS% +IF NOT EXIST .\gui\index.html ( + echo "Please make sure you have downloaded the web UI files from https://github.com/ssube/onnx-web/tree/gh-pages" + echo "See https://github.com/ssube/onnx-web/blob/main/docs/setup-guide.md#download-the-web-ui-bundle for more information" + pause +) + echo "Launching API server..." waitress-serve ^ --host=0.0.0.0 ^ diff --git a/api/launch.ps1 b/api/launch.ps1 index 19add137..ba898151 100644 --- a/api/launch.ps1 +++ b/api/launch.ps1 @@ -10,6 +10,13 @@ python -m onnx_web.convert ` --extras=$Env:ONNX_WEB_EXTRA_MODELS ` --token=$Env:HF_TOKEN $Env:ONNX_WEB_EXTRA_ARGS +if (!(Test-Path -path .\gui\index.html -PathType Leaf)) { + echo "Downloading latest web UI files from Github..." + Invoke-WebRequest "https://raw.githubusercontent.com/ssube/onnx-web/gh-pages/v0.11.0/index.html" -OutFile .\gui\index.html + Invoke-WebRequest "https://raw.githubusercontent.com/ssube/onnx-web/gh-pages/v0.11.0/config.json" -OutFile .\gui\config.json + Invoke-WebRequest "https://raw.githubusercontent.com/ssube/onnx-web/gh-pages/v0.11.0/bundle/main.js" -OutFile .\gui\bundle\main.js +} + echo "Launching API server..." waitress-serve ` --host=0.0.0.0 `