Skip to content

Commit

Permalink
feat(api): add a way to pass extra args to the conversion script
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Mar 9, 2023
1 parent 25c41c8 commit 35303c7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
9 changes: 8 additions & 1 deletion api/launch-extras.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
echo "Downloading and converting models to ONNX format..."
IF "%ONNX_WEB_EXTRA_MODELS%"=="" (set ONNX_WEB_EXTRA_MODELS=extras.json)
python -m onnx_web.convert --sources --diffusion --upscaling --correction --extras=%ONNX_WEB_EXTRA_MODELS% --token=%HF_TOKEN%
python -m onnx_web.convert ^
--sources ^
--diffusion ^
--upscaling ^
--correction ^
--extras=%ONNX_WEB_EXTRA_MODELS% ^
--token=%HF_TOKEN% ^
%ONNX_WEB_EXTRA_ARGS%

echo "Launching API server..."
flask --app="onnx_web.main:run" run --host=0.0.0.0
3 changes: 2 additions & 1 deletion api/launch-extras.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ python3 -m onnx_web.convert \
--upscaling \
--correction \
--extras=${ONNX_WEB_EXTRA_MODELS:-extras.json} \
--token=${HF_TOKEN:-}
--token=${HF_TOKEN:-} \
${ONNX_WEB_EXTRA_ARGS:-}

echo "Launching API server..."
flask --app='onnx_web.main:run' run --host=0.0.0.0
8 changes: 7 additions & 1 deletion api/launch.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
echo "Downloading and converting models to ONNX format..."
python -m onnx_web.convert --sources --diffusion --upscaling --correction --token=%HF_TOKEN%
python -m onnx_web.convert ^
--sources ^
--diffusion ^
--upscaling ^
--correction ^
--token=%HF_TOKEN% ^
%ONNX_WEB_EXTRA_ARGS%

echo "Launching API server..."
flask --app="onnx_web.main:run" run --host=0.0.0.0
3 changes: 2 additions & 1 deletion api/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ python3 -m onnx_web.convert \
--diffusion \
--upscaling \
--correction \
--token=${HF_TOKEN:-}
--token=${HF_TOKEN:-} \
${ONNX_WEB_EXTRA_ARGS:-}

echo "Launching API server..."
flask --app='onnx_web.main:run' run --host=0.0.0.0

0 comments on commit 35303c7

Please sign in to comment.