sd-webui fixes; add endpoint yamls

This commit is contained in:
Max Howell 2023-04-24 15:19:58 -04:00
parent eb280e08ba
commit 2dfa90044d
6 changed files with 58 additions and 26 deletions

View file

@ -1,21 +1,33 @@
#!/bin/bash
set -emx
set -emfo pipefail
d="$(cd "$(dirname $0)"/.. && pwd)"
tea gum format <<EoMD
# loading…
> *NOTE* this may take a few minutes the first time it runs
EoMD
echo # spacer
d="$(cd "$(dirname $0)" && pwd)"
"$d"/bin/stable-diffusion-webui &
# poll into a HEAD request succeeds
# poll until a HEAD request succeeds
while ! curl -Is http://127.0.0.1:7860 | grep -q "HTTP/1.1 200 OK"; do
sleep 1
done
# open the URL once the HEAD request succeeds
# TODO open in a window controlled by the gui (see next section)
open http://127.0.0.1:7860
# tell tea/gui about it
echo '{"viewer": "http://127.0.0.1:7860"}'
if test -n "$TEA_IPC_FD"; then
echo '{"viewer": "http://127.0.0.1:7860"}' >&$TEA_IPC_FD
fi
tea gum format <<EoMD
# Stable Diffusion WEBUI
@ -34,4 +46,6 @@ this package has been modified for your convenience:
enjoy!
EoMD
fg
echo # spacer
fg # unbackground the webui process

View file

@ -1,8 +0,0 @@
diff --color -u a/launch.py b/launch.py
--- a/launch.py 2023-04-19 15:28:49
+++ b/launch.py 2023-04-19 15:28:56
@@ -353,4 +353,3 @@
if __name__ == "__main__":
prepare_environment()
- start()

View file

@ -34,7 +34,7 @@ build:
# move this installation into its prefix
- run: |
mv $OLDWD lib
mkdir tbin bin
mkdir -p bin
mkdir $OLDWD # or breaks brewkit
working-directory: ${{prefix}}
@ -43,11 +43,11 @@ build:
# install our scripts and shims
- |
cp lib/props/webui-user.sh lib
cp lib/props/gui.sh tbin
cp lib/props/entrypoint.sh .
cp lib/props/stable-diffusion-webui bin
# delete our crap
- rm -rf lib/props lib/xyz.tea.*
- rm -rf lib/props lib/xyz.tea.* lib/tea.yaml
# we set this as a symlink to ~/.local/share/models in our stub scripts
- rm -rf lib/models/Stable-diffusion lib/extensions lib/outputs
@ -63,7 +63,8 @@ build:
provides:
- bin/stable-diffusion-webui
- tbin/gui.sh
entrypoint: ./entrypoint.sh
test:
stable-diffusion-webui --help

View file

@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/bash
set -ex
set -eo pipefail
export install_dir="$(cd "$(dirname $0)"/.. && pwd)"
export install_dir="$(cd "$(dirname "$0")"/.. && pwd)"
export clone_dir=lib
cd "$install_dir"/"$clone_dir"
@ -41,4 +41,27 @@ if ! test -f "$CONFIG"; then
EoJSON
fi
python ./launch.py "$@" --ui-config-file="$CONFIG"
#NOTE sourced from brewkit python-venv.sh results
export VIRTUAL_ENV="$PWD"/venv
TEA_PYTHON="$(which python)"
TEA_PYHOME="$(dirname "$TEA_PYTHON")"
cat <<EOSH > "$VIRTUAL_ENV"/pyvenv.cfg
home = $TEA_PYHOME
include-system-site-packages = false
executable = $TEA_PYTHON
EOSH
find "$VIRTUAL_ENV"/bin -maxdepth 1 -type f | xargs \
sed -i.bak "1s|.*|#!$VIRTUAL_ENV/bin/python|"
rm "$VIRTUAL_ENV"/bin/*.bak
ln -sf "$TEA_PYTHON" "$VIRTUAL_ENV"/bin/python
#NOTE.END
# this is all `activate` in the venv does
export PATH="$VIRTUAL_ENV/bin":$PATH
exec python ./launch.py "$@" --ui-config-file="$CONFIG"

View file

@ -1,3 +1,3 @@
#!/bin/bash
export install_dir="$(cd "$(dirname $0)"/.. && pwd)"
export install_dir="$(cd "$(dirname "$0")"/.. && pwd)"
export clone_dir="lib"

View file

@ -3,11 +3,14 @@ distributable:
strip-components: 1
versions:
github: muesli/duf/tags
github: muesli/duf/tags
provides:
- bin/duf
entrypoint:
bin/duf
build:
script: |
go mod download
@ -27,5 +30,4 @@ build:
- -buildmode=pie
test:
script: |
test "$(duf -version)" = "duf {{version}}"
test "$(duf -version)" = "duf {{version}}"