Introduction
Introduction Statistics Contact Development Disclaimer Help
Make emoji support work again with stable diffusion. - annna - Annna the nice f…
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit eea3e376d4aca6465997b052660b740bbcea84aa
parent fa3ed1c3bff3a60cf31a67dcfadf6e7e88daab8e
Author: Annna Robert-Houdin <[email protected]>
Date: Sat, 21 Oct 2023 15:19:48 +0200
Make emoji support work again with stable diffusion.
Diffstat:
M annna-message-common | 2 +-
A stable-diffusion | 18 ++++++++++++++++++
A stable-diffusion-emoji | 36 +++++++++++++++++++++++++++++…
3 files changed, 55 insertions(+), 1 deletion(-)
---
diff --git a/annna-message-common b/annna-message-common
@@ -47,7 +47,7 @@ case "${text}" in
;;
*::*::*)
query=${text#**::} query=${query%%::*}
- annna-say -s "${server}" -c "${channel}" "$(dalle-gen-emoji "${query}"…
+ annna-say -s "${server}" -c "${channel}" "$(stable-diffusion-emoji "${…
;;
*http*://*|*ytdl://*)
case "${text}" in
diff --git a/stable-diffusion b/stable-diffusion
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+if [ $# -lt 2 ];
+then
+ printf "usage: %s output.png some funny cat prompt ...\n" \
+ "$(basename "${0}")" >&2
+ exit 1
+fi
+
+sdbase="/br/ai/stable-diffusion.cpp"
+sdcmd="${sdbase}/build/bin/sd -t 8"
+sdmodel="${sdbase}/v2-1_768-nonema-pruned-ggml-model-f16.bin"
+outputf="${1}"
+shift 1
+
+#${sdcmd} -m ${sdmodel} -o "${outputf}" -p "$@"
+${sdcmd} -m ${sdmodel} -o "${outputf}" -p "$@" 2>&1 >/dev/null
+
diff --git a/stable-diffusion-emoji b/stable-diffusion-emoji
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+if [ $# -lt 1 ];
+then
+ printf "usage: %s :some:emoji:\n" \
+ "$(basename "${0}")" >&2
+ exit 1
+fi
+
+export PATH="$HOME/bin:$PATH"
+
+emojidb="/br/gopher/emoji"
+emojiuribase="gophers://bitreich.org/9/emoji"
+
+emojistr="$@"
+emojiprompt="$(printf "%s\n" "${emojistr}" \
+ | sed 's,^::,,' \
+ | sed 's,::$,,' \
+ | sed 's|,| |g' \
+ | sed 's|:| |g' \
+ | sed 's|=| |g' \
+ | sed 's|/| |g' \
+ | sed 's|-| |g' \
+ | sed 's|\.| |g')"
+emojifile="$(printf "%s\n" "${emojiprompt}" \
+ | cut -c -32 \
+ | sed 's, ,-,g').png"
+
+[ -z "${emojiprompt}" ] && exit 1
+
+if [ ! -e "${emojidb}/${emojifile}" ];
+then
+ stable-diffusion "${emojidb}/${emojifile}" "${emojiprompt}"
+fi
+[ $? -eq 0 ] && printf "gophers://bitreich.org/9/emoji/%s\n" "${emojifile}"
+
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.