pantry/projects/github.com/AUTOMATIC1111/stable-diffusion-webui/entrypoint.sh

56 lines
1.2 KiB
Bash
Raw Normal View History

2023-04-20 15:21:35 +03:00
#!/bin/bash
2023-04-24 22:19:58 +03:00
set -emfo pipefail
2023-04-20 15:21:35 +03:00
2023-04-24 22:19:58 +03:00
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)"
2023-04-20 15:21:35 +03:00
"$d"/bin/stable-diffusion-webui &
2023-05-09 18:21:24 +03:00
PID=$!
2023-04-24 22:19:58 +03:00
# poll until a HEAD request succeeds
2023-04-20 15:21:35 +03:00
while ! curl -Is http://127.0.0.1:7860 | grep -q "HTTP/1.1 200 OK"; do
2023-05-09 18:21:24 +03:00
if ! kill -0 $PID; then
echo "webui process died!"
exit 1
fi
2023-04-20 15:21:35 +03:00
sleep 1
done
# open the URL once the HEAD request succeeds
2023-07-05 18:57:08 +03:00
if test -n "$TEA_GUI"; then
echo '{"xyz.tea":{"gui":"http://127.0.0.1:7860"}}' >&2
else
open "http://127.0.0.1:7860"
2023-04-24 22:19:58 +03:00
fi
2023-04-20 15:21:35 +03:00
tea gum format <<EoMD
# Stable Diffusion WEBUI
this package has been modified for your convenience:
2023-04-28 18:42:01 +03:00
* download additional Stable Diffusion models to \`~/.local/share/models/stable-diffusion\`
* extensions can be added to \`~/.local/share/stable-diffusion-webui/extensions\`
* generated images are saved to \`~/Documents/Stable Diffusion WEBUI\`
* configuration is saved to \`~/.config/stable-diffusion-webui\`
2023-04-20 15:21:35 +03:00
> *NOTE* we obey \`XDG_\` variables for all the above if they are set
> bugs reports to our [tracker](https://github.com/teaxyz/pantry/issues). thanks!
enjoy!
EoMD
2023-04-24 22:19:58 +03:00
echo # spacer
fg # unbackground the webui process