Allows passing args to webui.sh and webui.cmd (#1385)

This change helps with starting the stable horde bridge, without having
to change the relauncher.py every time. It also allows one to start
multiple bridges (for multiple GPUs) by passing the `-n` argument to the
.cmd/.sh
This commit is contained in:
Divided by Zer0 2022-10-02 20:24:23 +02:00 committed by GitHub
parent 481c4d83cd
commit bb8850b9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -36,13 +36,18 @@ share = False
# Generate tiling images
tiling = False
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-n', '--horde_name', action="store", required=False, type=str, help="The server name for the Horde. It will be shown to the world and there can be only one.")
args = parser.parse_args()
# Enter other `--arguments` you wish to use - Must be entered as a `--argument ` syntax
additional_arguments = ""
if args.horde_name:
additional_arguments += f' --horde_name {args.horde_name}'
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-n', '--horde_name', action="store", required=False, type=str, help="The server name for the Horde. It will be shown to the world and there can be only one.")
parser.add_argument('--bridge', action="store_true", required=False, default=True, help="When specified, start the stable horde bridge instead of the webui.")
args = parser.parse_args()
if args.bridge:
additional_arguments += f' --bridge'
if args.horde_name:
additional_arguments += f' --horde_name "{args.horde_name}"'

View File

@ -162,7 +162,7 @@ launch_webui () {
select yn in "Streamlit" "Gradio"; do
case $yn in
Streamlit ) printf "\nStarting Stable Diffusion WebUI: Streamlit Interface. Please Wait...\n"; python -m streamlit run scripts/webui_streamlit.py; break;;
Gradio ) printf "\nStarting Stable Diffusion WebUI: Gradio Interface. Please Wait...\n"; python scripts/relauncher.py $@; break;;
Gradio ) printf "\nStarting Stable Diffusion WebUI: Gradio Interface. Please Wait...\n"; python scripts/relauncher.py "$@"; break;;
esac
done
}
@ -177,8 +177,8 @@ start_initialization () {
echo "Your model file does not exist! Place it in 'models/ldm/stable-diffusion-v1' with the name 'model.ckpt'."
exit 1
fi
launch_webui
launch_webui "$@"
}
start_initialization
start_initialization "$@"