Skip to content

Commit 1cb8896

Browse files
committed
this is release candidate 2.3.3-rc1
Incorporates a modified version of the dialog-based invoke.sh script suggested by JoshuaKimsey: https://discord.com/channels/1020123559063990373/1089119602425995304
1 parent 610a148 commit 1cb8896

File tree

1 file changed

+105
-45
lines changed

1 file changed

+105
-45
lines changed

installer/templates/invoke.sh.in

Lines changed: 105 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
# coauthored by Lincoln Stein, Eugene Brodsky and JoshuaKimsey
4+
# Copyright 2023, The InvokeAI Development Team
5+
36
####
47
# This launch script assumes that:
58
# 1. it is located in the runtime directory,
@@ -18,78 +21,135 @@ cd "$scriptdir"
1821
. .venv/bin/activate
1922

2023
export INVOKEAI_ROOT="$scriptdir"
24+
PARAMS=$@
2125

2226
# set required env var for torch on mac MPS
2327
if [ "$(uname -s)" == "Darwin" ]; then
2428
export PYTORCH_ENABLE_MPS_FALLBACK=1
2529
fi
2630

27-
if [ "$0" != "bash" ]; then
28-
while true
29-
do
30-
echo "Do you want to generate images using the"
31-
echo "1. command-line interface"
32-
echo "2. browser-based UI"
33-
echo "3. run textual inversion training"
34-
echo "4. merge models (diffusers type only)"
35-
echo "5. download and install models"
36-
echo "6. change InvokeAI startup options"
37-
echo "7. re-run the configure script to fix a broken install"
38-
echo "8. open the developer console"
39-
echo "9. update InvokeAI"
40-
echo "10. command-line help"
41-
echo "Q - Quit"
42-
echo ""
43-
read -p "Please enter 1-10, Q: [2] " yn
44-
choice=${yn:='2'}
45-
case $choice in
46-
1)
47-
echo "Starting the InvokeAI command-line..."
48-
invokeai $@
31+
do_choice() {
32+
case $1 in
33+
1)
34+
echo "Generate images with a browser-based interface"
35+
clear
36+
invokeai --web $PARAMS
4937
;;
50-
2)
51-
echo "Starting the InvokeAI browser-based UI..."
52-
invokeai --web $@
38+
2)
39+
echo "Generate images using a command-line interface"
40+
clear
41+
invokeai $PARAMS
5342
;;
54-
3)
55-
echo "Starting Textual Inversion:"
56-
invokeai-ti --gui $@
43+
3)
44+
echo "Textual inversion training"
45+
clear
46+
invokeai-ti --gui $PARAMS
5747
;;
58-
4)
59-
echo "Merging Models:"
60-
invokeai-merge --gui $@
48+
4)
49+
echo "Merge models (diffusers type only)"
50+
clear
51+
invokeai-merge --gui $PARAMS
6152
;;
62-
5)
53+
5)
54+
echo "Download and install models"
55+
clear
6356
invokeai-model-install --root ${INVOKEAI_ROOT}
6457
;;
65-
6)
58+
6)
59+
echo "Change InvokeAI startup options"
60+
clear
6661
invokeai-configure --root ${INVOKEAI_ROOT} --skip-sd-weights --skip-support-models
6762
;;
68-
7)
63+
7)
64+
echo "Re-run the configure script to fix a broken install"
65+
clear
6966
invokeai-configure --root ${INVOKEAI_ROOT} --yes --default_only
7067
;;
71-
8)
72-
echo "Developer Console:"
68+
8)
69+
echo "Open the developer console"
70+
clear
7371
file_name=$(basename "${BASH_SOURCE[0]}")
7472
bash --init-file "$file_name"
7573
;;
76-
9)
77-
echo "Update:"
74+
9)
75+
echo "Update InvokeAI"
76+
clear
7877
invokeai-update
7978
;;
80-
10)
79+
10)
80+
echo "Command-line help"
81+
clear
8182
invokeai --help
8283
;;
83-
[qQ])
84-
exit 0
84+
*)
85+
echo "Exiting..."
86+
exit
8587
;;
86-
*)
87-
echo "Invalid selection"
88-
exit;;
8988
esac
90-
done
89+
clear
90+
}
91+
92+
do_dialog() {
93+
while true
94+
do
95+
options=(
96+
1 "Generate images with a browser-based interface"
97+
2 "Generate images using a command-line interface"
98+
3 "Textual inversion training"
99+
4 "Merge models (diffusers type only)"
100+
5 "Download and install models"
101+
6 "Change InvokeAI startup options"
102+
7 "Re-run the configure script to fix a broken install"
103+
8 "Open the developer console"
104+
9 "Update InvokeAI"
105+
10 "Command-line help")
106+
107+
choice=$(dialog --clear \
108+
--backtitle "InvokeAI" \
109+
--title "What you like to run?" \
110+
--menu "Select an option:" \
111+
0 0 0 \
112+
"${options[@]}" \
113+
2>&1 >/dev/tty) || clear
114+
do_choice "$choice"
115+
done
116+
clear
117+
}
118+
119+
do_line_input() {
120+
echo " ** For a more attractive experience, please install the 'dialog' utility. **"
121+
echo ""
122+
while true
123+
do
124+
echo "Do you want to generate images using the"
125+
echo "1. browser-based UI"
126+
echo "2. command-line interface"
127+
echo "3. run textual inversion training"
128+
echo "4. merge models (diffusers type only)"
129+
echo "5. download and install models"
130+
echo "6. change InvokeAI startup options"
131+
echo "7. re-run the configure script to fix a broken install"
132+
echo "8. open the developer console"
133+
echo "9. update InvokeAI"
134+
echo "10. command-line help"
135+
echo "Q - Quit"
136+
echo ""
137+
read -p "Please enter 1-10, Q: [1] " yn
138+
choice=${yn:='1'}
139+
do_choice $choice
140+
done
141+
}
142+
143+
if [ "$0" != "bash" ]; then
144+
# Dialog seems to be a standard installtion for most Linux distros, but this checks to ensure it is present regardless
145+
if command -v dialog &> /dev/null ; then
146+
do_dialog
147+
else
148+
do_line_input
149+
fi
91150
else # in developer console
92151
python --version
93152
echo "Press ^D to exit"
94153
export PS1="(InvokeAI) \u@\h \w> "
95154
fi
155+

0 commit comments

Comments
 (0)