mirror of
https://github.com/ivabus/pantry
synced 2024-11-26 18:25:08 +03:00
+stable-diffusion-webui
This commit is contained in:
parent
3841271582
commit
826e44a57a
5 changed files with 159 additions and 0 deletions
37
projects/github.com/AUTOMATIC1111/stable-diffusion-webui/gui.sh
Executable file
37
projects/github.com/AUTOMATIC1111/stable-diffusion-webui/gui.sh
Executable file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -emx
|
||||||
|
|
||||||
|
d="$(cd "$(dirname $0)"/.. && pwd)"
|
||||||
|
|
||||||
|
"$d"/bin/stable-diffusion-webui &
|
||||||
|
|
||||||
|
# poll into 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
|
||||||
|
open http://127.0.0.1:7860
|
||||||
|
|
||||||
|
# tell tea/gui about it
|
||||||
|
echo '{"viewer": "http://127.0.0.1:7860"}'
|
||||||
|
|
||||||
|
tea gum format <<EoMD
|
||||||
|
# Stable Diffusion WEBUI
|
||||||
|
|
||||||
|
this package has been modified for your convenience:
|
||||||
|
|
||||||
|
* Stable Diffusion models can be added 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
|
||||||
|
|
||||||
|
> *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
|
||||||
|
|
||||||
|
fg
|
|
@ -0,0 +1,8 @@
|
||||||
|
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()
|
|
@ -0,0 +1,67 @@
|
||||||
|
distributable:
|
||||||
|
url: https://github.com/AUTOMATIC1111/stable-diffusion-webui/archive/22bcc7be.tar.gz
|
||||||
|
strip-components: 1
|
||||||
|
|
||||||
|
versions:
|
||||||
|
- 2023.03.29
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
python.org: ~3.10
|
||||||
|
|
||||||
|
build:
|
||||||
|
dependencies:
|
||||||
|
pip.pypa.io: '*'
|
||||||
|
gnu.org/wget: '*'
|
||||||
|
protobuf.dev: '>=21'
|
||||||
|
rust-lang.org: ^1 # docs say this is needed but I’m not convinced…
|
||||||
|
git-scm.org: ^2
|
||||||
|
script:
|
||||||
|
# don’t download the models RN
|
||||||
|
# --exit just installs deps and exits rather than boots the web server
|
||||||
|
- echo 'export COMMANDLINE_ARGS="
|
||||||
|
--no-download-sd-model
|
||||||
|
--exit
|
||||||
|
$COMMANDLINE_ARGS"' > webui-user.sh
|
||||||
|
|
||||||
|
# or it clones HEAD and uses that
|
||||||
|
- mkdir -p .git
|
||||||
|
|
||||||
|
# installs python virtual-env
|
||||||
|
- ./webui.sh
|
||||||
|
|
||||||
|
# move this installation into its prefix
|
||||||
|
- run: |
|
||||||
|
mv $OLDWD lib
|
||||||
|
mkdir tbin bin
|
||||||
|
mkdir $OLDWD # or breaks brewkit
|
||||||
|
working-directory: ${{prefix}}
|
||||||
|
|
||||||
|
- cd {{prefix}} # change CWD for remainder of our execution
|
||||||
|
|
||||||
|
# install our scripts and shims
|
||||||
|
- |
|
||||||
|
cp lib/props/webui-user.sh lib
|
||||||
|
cp lib/props/gui.sh tbin
|
||||||
|
cp lib/props/stable-diffusion-webui bin
|
||||||
|
|
||||||
|
# delete our crap
|
||||||
|
- rm -rf lib/props lib/xyz.tea.*
|
||||||
|
|
||||||
|
# we set this as a symlink to ~/.local/share/models in our stub scripts
|
||||||
|
- rm -rf lib/models/Stable-diffusion lib/extensions lib/outputs
|
||||||
|
|
||||||
|
# we prebuilt everything, but also we must remove this so we can trim
|
||||||
|
# the final package from 2.3GB to ~1GB which we will do in the next steps
|
||||||
|
- |
|
||||||
|
sed -i.bak '355s|prepare_environment()||' lib/launch.py
|
||||||
|
rm lib/launch.py.bak
|
||||||
|
#FIXME ^^ please make a .patch work, I could not :/
|
||||||
|
|
||||||
|
- find . -name .git\* | xargs rm -rf
|
||||||
|
|
||||||
|
provides:
|
||||||
|
- bin/stable-diffusion-webui
|
||||||
|
- tbin/gui.sh
|
||||||
|
|
||||||
|
test:
|
||||||
|
stable-diffusion-webui --help
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
export install_dir="$(cd "$(dirname $0)"/.. && pwd)"
|
||||||
|
export clone_dir=lib
|
||||||
|
|
||||||
|
cd "$install_dir"/"$clone_dir"
|
||||||
|
|
||||||
|
source ./webui-macos-env.sh
|
||||||
|
source ./webui-user.sh
|
||||||
|
|
||||||
|
XDG="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||||
|
|
||||||
|
mkdir -p "$XDG"/models/stable-diffusion "$XDG"/stable-diffusion-webui "$HOME/Documents/Stable Diffusion WEBUI"
|
||||||
|
|
||||||
|
# store models somewhere shared
|
||||||
|
if ! test -d "$install_dir"/lib/models/Stable-diffusion; then
|
||||||
|
ln -sf "$XDG"/models/stable-diffusion "$install_dir"/lib/models/Stable-diffusion
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make extensions easily available and shared
|
||||||
|
if ! test -d "$install_dir"/lib/extensions; then
|
||||||
|
ln -sf "$XDG"/stable-diffusion-webui "$install_dir"/lib/extensions
|
||||||
|
fi
|
||||||
|
|
||||||
|
# output files somewhere public
|
||||||
|
if ! test -d "$install_dir"/lib/outputs; then
|
||||||
|
ln -sf "$HOME/Documents/Stable Diffusion WEBUI" "$install_dir"/lib/outputs
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}"/stable-diffusion-webui/config.json
|
||||||
|
|
||||||
|
if ! test -f "$CONFIG"; then
|
||||||
|
mkdir -p "$(dirname "$CONFIG")"
|
||||||
|
cat << EoJSON > "$CONFIG"
|
||||||
|
{
|
||||||
|
"img2img/Output directory/visible": true,
|
||||||
|
"img2img/Output directory/value": ""
|
||||||
|
}
|
||||||
|
EoJSON
|
||||||
|
fi
|
||||||
|
|
||||||
|
python ./launch.py "$@" --ui-config-file="$CONFIG"
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
export install_dir="$(cd "$(dirname $0)"/.. && pwd)"
|
||||||
|
export clone_dir="lib"
|
Loading…
Reference in a new issue