1
0
Fork 0

fix(api): check for web UI files in Windows launch scripts

This commit is contained in:
Sean Sube 2023-12-10 17:03:54 -06:00
parent 0155236744
commit 2a641b111e
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 15 additions and 0 deletions

View File

@ -1,5 +1,7 @@
call onnx_env\Scripts\Activate.bat 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..." echo "Downloading and converting models to ONNX format..."
IF "%ONNX_WEB_EXTRA_MODELS%"=="" (set ONNX_WEB_EXTRA_MODELS=..\models\extras.json) IF "%ONNX_WEB_EXTRA_MODELS%"=="" (set ONNX_WEB_EXTRA_MODELS=..\models\extras.json)
python -m onnx_web.convert ^ python -m onnx_web.convert ^
@ -10,6 +12,12 @@ python -m onnx_web.convert ^
--extras=%ONNX_WEB_EXTRA_MODELS% ^ --extras=%ONNX_WEB_EXTRA_MODELS% ^
--token=%HF_TOKEN% %ONNX_WEB_EXTRA_ARGS% --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..." echo "Launching API server..."
waitress-serve ^ waitress-serve ^
--host=0.0.0.0 ^ --host=0.0.0.0 ^

View File

@ -10,6 +10,13 @@ python -m onnx_web.convert `
--extras=$Env:ONNX_WEB_EXTRA_MODELS ` --extras=$Env:ONNX_WEB_EXTRA_MODELS `
--token=$Env:HF_TOKEN $Env:ONNX_WEB_EXTRA_ARGS --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..." echo "Launching API server..."
waitress-serve ` waitress-serve `
--host=0.0.0.0 ` --host=0.0.0.0 `