Add prototype for new diffuser script stable diffusion. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit c8640269562affe26326ce1d4e1d825423248708 DIR parent 611fd89597b63604202c941fca1c54d4f017353a HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 12 Nov 2023 17:28:28 +0100 Add prototype for new diffuser script stable diffusion. Diffstat: A stable-diffusion-diffusers | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+), 0 deletions(-) --- DIR diff --git a/stable-diffusion-diffusers b/stable-diffusion-diffusers @@ -0,0 +1,33 @@ +#!/bin/sh + +sdbin="/br/ai/diffusers/diffusers-sdxl-lcm-lora.py" + +if [ $# -lt 1 ]; +then + printf "usage: %s :some:emoji:\n" \ + "$(basename "${0}")" >&2 + exit 1 +fi + +export PATH="$HOME/bin:$PATH" + +emojidb="/br/gopher/diffusers" +emojiuribase="gophers://bitreich.org/I/diffusers" + +emojistr="$@" +emojiprompt="$(printf "%s\n" "${emojistr}" \ + | sed 's,^::,,; s,::$,,; s|[-,:=/\.]| |g')" +emojifile="$(printf "%s\n" "${emojiprompt}" \ + | cut -c -64 \ + | sed 's, ,-,g').png" + +[ -z "${emojiprompt}" ] && exit 1 + +if [ ! -e "${emojidb}/${emojifile}" ]; +then + SD_MODEL="stabilityai/stable-diffusion-xl-base-1.0" \ + LORA_ID="latent-consistency/lcm-lora-sdxl" \ + $sdbin "${emojidb}/${emojifile}" "${emojiprompt}" +fi +[ $? -eq 0 ] && printf "%s/%s\n" "${emojiuribase}" "${emojifile}" +