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

52 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-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
sleep 1
done
# open the URL once the HEAD request succeeds
2023-04-24 22:19:58 +03:00
# TODO open in a window controlled by the gui (see next section)
2023-04-20 15:21:35 +03:00
open http://127.0.0.1:7860
# tell tea/gui about it
2023-04-24 22:19:58 +03:00
if test -n "$TEA_IPC_FD"; then
echo '{"viewer": "http://127.0.0.1:7860"}' >&$TEA_IPC_FD
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