Allow start scripts to have command-line flags

This commit is contained in:
oobabooga 2023-09-22 10:03:56 -07:00
parent 8ab3eca9ec
commit 3314b7d795
7 changed files with 8 additions and 8 deletions

View File

@ -1 +0,0 @@
--listen

View File

@ -64,4 +64,4 @@ source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" # otherwise conda complains a
conda activate "$INSTALL_ENV_DIR"
# setup installer env
python webui.py
python webui.py $@

View File

@ -64,4 +64,4 @@ source "$CONDA_ROOT_PREFIX/etc/profile.d/conda.sh" # otherwise conda complains a
conda activate "$INSTALL_ENV_DIR"
# setup installer env
python webui.py
python webui.py $@

View File

@ -67,7 +67,7 @@ set "CUDA_HOME=%CUDA_PATH%"
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo Miniconda hook not found. && goto end )
@rem setup installer env
call python webui.py
call python webui.py %*
@rem below are functions for the script next line skips these during normal execution
goto end

View File

@ -5,7 +5,7 @@ cd /D "%~dp0"
set PATH=%PATH%;%SystemRoot%\system32
@rem sed -i 's/\x0D$//' ./wsl.sh converts newlines to unix format in the wsl script
call wsl -e bash -lic "sed -i 's/\x0D$//' ./wsl.sh; source ./wsl.sh"
call wsl -e bash -lic "sed -i 's/\x0D$//' ./wsl.sh; source ./wsl.sh $@"
:end
pause

View File

@ -245,7 +245,8 @@ def download_model():
def launch_webui():
run_cmd(f"python server.py {CMD_FLAGS}", environment=True)
flags = [flag for flag in sys.argv[1:] if flag != '--update']
run_cmd(f"python server.py {' '.join(flags)} {CMD_FLAGS}", environment=True)
if __name__ == "__main__":
@ -254,7 +255,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--update', action='store_true', help='Update the web UI.')
args = parser.parse_args()
args, _ = parser.parse_known_args()
if args.update:
update_dependencies()

2
wsl.sh
View File

@ -106,5 +106,5 @@ fi
# setup installer env update env if called with 'wsl.sh update'
case "$1" in
("update") python webui.py --update;;
(*) python webui.py;;
(*) python webui.py $@;;
esac