#!/bin/bash set -eu # ensure we're in the correct folder in case user's CWD is somewhere else scriptdir=$(dirname "$0") cd "$scriptdir" . .venv/bin/activate export INVOKEAI_ROOT="$scriptdir" # set required env var for torch on mac MPS if [ "$(uname -s)" == "Darwin" ]; then export PYTORCH_ENABLE_MPS_FALLBACK=1 fi if [ "$0" != "bash" ]; then echo "Do you want to generate images using the" echo "1. command-line" echo "2. browser-based UI" echo "3. run textual inversion training" echo "4. merge models (diffusers type only)" echo "5. open the developer console" echo "6. re-run the configure script to download new models" read -p "Please enter 1, 2, 3, 4 or 5: [1] " yn choice=${yn:='2'} case $choice in 1 ) printf "\nStarting the InvokeAI command-line..\n"; invoke $*;; 2 ) printf "\nStarting the InvokeAI browser-based UI..\n"; invoke --web $*;; 3 ) printf "\nStarting Textual Inversion:\n"; textual_inversion --gui $*;; 4 ) printf "\nMerging Models:\n"; merge_models --gui $*;; 5 ) printf "\nDeveloper Console:\n"; file_name=$(basename "${BASH_SOURCE[0]}"); bash --init-file "$file_name";; 6 ) printf "\nRunning configure_invokeai.py:\n"; configure_invokeai $*;; * ) echo "Invalid selection"; exit;; esac else # in developer console python --version echo "Press ^D to exit" export PS1="(InvokeAI) \u@\h \w> " fi