From 481955c6ba61bb6d415f9a3a963a04931af95696 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Thu, 9 Mar 2023 22:53:04 +0600 Subject: Feat: add scripts to generate dynamic data --- get_sd_image.sh | 27 +++++++++++++++++++++++++++ index.html | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ nessi_avatar.jpg | Bin 0 -> 13396 bytes nessi_generated.jpg | Bin 0 -> 348863 bytes replace_phrase.sh | 17 +++++++++++++++++ todays_audio.opus | Bin 0 -> 67235 bytes todays_audio.opus.json | 1 + todays_audio.opus.srt | 4 ++++ todays_audio.opus.tsv | 2 ++ todays_audio.opus.txt | 1 + todays_audio.opus.vtt | 5 +++++ update_index.sh | 18 ++++++++++++++++++ 12 files changed, 123 insertions(+) create mode 100755 get_sd_image.sh create mode 100644 index.html create mode 100644 nessi_avatar.jpg create mode 100644 nessi_generated.jpg create mode 100755 replace_phrase.sh create mode 100644 todays_audio.opus create mode 100644 todays_audio.opus.json create mode 100644 todays_audio.opus.srt create mode 100644 todays_audio.opus.tsv create mode 100644 todays_audio.opus.txt create mode 100644 todays_audio.opus.vtt create mode 100755 update_index.sh diff --git a/get_sd_image.sh b/get_sd_image.sh new file mode 100755 index 0000000..4d9d875 --- /dev/null +++ b/get_sd_image.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +set -e + +prompt=${1:-} +steps=${2:-25} + +commonNegative="(((deformed))), blurry, bad anatomy, disfigured, poorly drawn face, mutation, mutated, (extra_limb), (ugly), (poorly drawn hands), fused fingers, messy drawing, broken legs censor, censored, censor_bar, multiple breasts, (mutated hands and fingers:1.5), (long body :1.3), (mutation, poorly drawn :1.2), black-white, bad anatomy, liquid body, liquidtongue, disfigured, malformed, mutated, anatomical nonsense, text font ui, error, malformed hands, long neck, blurred, lowers, low res, bad anatomy, bad proportions, bad shadow, uncoordinated body, unnatural body, fused breasts, bad breasts, huge breasts, poorly drawn breasts, extra breasts, liquid breasts, heavy breasts, missingbreasts, huge haunch, huge thighs, huge calf, bad hands, fused hand, missing hand, disappearing arms, disappearing thigh, disappearing calf, disappearing legs, fusedears, bad ears, poorly drawn ears, extra ears, liquid ears, heavy ears, missing ears, old photo, low res, black and white, black and white filter, colorless, (((deformed))), blurry, bad anatomy, disfigured, poorly drawn face, mutation, mutated, (extra_limb), (ugly), (poorly drawn hands), fused fingers, messy drawing, broken legs censor, censored, censor_bar, multiple breasts, (mutated hands and fingers:1.5), (long body :1.3), (mutation, poorly drawn :1.2), black-white, bad anatomy, liquid body, liquid tongue, disfigured, malformed, mutated, anatomical nonsense, text font ui, error, malformed hands, long neck, blurred, lowers, low res, bad anatomy, bad proportions, bad shadow, uncoordinated body, unnatural body, fused breasts, bad breasts, huge breasts, poorly drawn breasts, extra breasts, liquid breasts, heavy breasts, missing breasts, huge haunch, huge thighs, huge calf, bad hands, fused hand, missing hand, disappearing arms, disappearing thigh, disappearing calf, disappearing legs, fused ears, bad ears, poorly drawn ears, extra ears, liquid ears, heavy ears, missing ears, old photo, low res, black and white, black and white filter, colorless, (((deformed))), blurry, bad anatomy, disfigured, poorly drawn face, mutation, mutated, (extra_limb), (ugly), (poorly drawn hands), fused fingers, messy drawing, broken legs censor, censored, censor_bar, multiple breasts, (mutated hands and fingers:1.5), (long body :1.3), (mutation, poorly drawn :1.2), black-white, bad anatomy, liquid body, liquid tongue, disfigured, malformed, mutated, anatomical nonsense, text font ui, error, malformed hands, long neck, blurred, lowers, low res, bad anatomy, bad proportions, bad shadow, uncoordinated body, unnatural body, fused breasts, bad breasts, huge breasts, poorly drawn breasts, extra breasts, liquid breasts, heavy breasts, missing breasts, huge haunch, huge thighs, huge calf, bad hands, fused hand, missing hand, disappearing arms, disappearing thigh, disappearing calf, disappearing legs, fused ears, bad ears, poorly drawn ears, extra ears, liquid ears, heavy ears, missing ears, (((deformed))), blurry, bad anatomy, disfigured, poorly drawn face, mutation, mutated, (extra_limb), (ugly), (poorly drawn hands), fused fingers, messy drawing, broken legs censor, censored, censor_bar, multiple breasts, (mutated hands and fingers:1.5), (long body :1.3), (mutation, poorly drawn :1.2), black-white, bad anatomy, liquid body, liquidtongue, disfigured, malformed, mutated, anatomical nonsense, text font ui, error, malformed hands, long neck, blurred, lowers, low res, bad anatomy, bad proportions, bad shadow, uncoordinated body, unnatural body, fused breasts, bad breasts, huge breasts, poorly drawn breasts, extra breasts, liquid breasts, heavy breasts, missingbreasts, huge haunch, huge thighs, huge calf, bad hands, fused hand, missing hand, disappearing arms, disappearing thigh, disappearing calf, disappearing legs, fusedears, bad ears, poorly drawn ears, extra ears, liquid ears, heavy ears, missing ears, authors signature, writing, emoji" + +# model="DPM++ 2M Karras" +model="DPM++ 2M Karras" + +imgPath=./nessi_avatar.jpg +sourceIMG=$(base64 -w 0 "$imgPath") +sourceIMG=$"\"$sourceIMG\"" + +resp=$(curl --data "{\"init_images\": ["$sourceIMG"], \"steps\":\"$steps\", \"prompt\":\"$prompt\", \"sampler_index\":\"$model\", \"sampler_name\":\"$model\", \"negative_prompt\": \"$commonNegative\", \"denoising_strength\": 0.55, \"cfg_scale\": 23}" --header 'Content-Type: application/json' http://127.0.0.1:7860/sdapi/v1/img2img) + +# curl --data '{"steps":25, "prompt":"confused chess player", "sampler_index":"DPM++ 2M Karras", "sampler_name":"DPM++ 2M Karras"}' --header 'Content-Type: application/json' http://127.0.0.1:7860/sdapi/v1/txt2img > temp.json +# echo $resp > temp.json + +# outname=$(printf "$prompt$steps" | xxhsum | cut -d " " -f 1) +outname="nessi_generated" +outname="$outname.jpg" + +echo $resp | jq -r '.images[]' | base64 -d > $outname +# jq -r '.images[]' temp.json | base64 -d > $outname diff --git a/index.html b/index.html new file mode 100644 index 0000000..1c09e88 --- /dev/null +++ b/index.html @@ -0,0 +1,48 @@ + + + + Index page + + + + + + +
+

Todays phrase

+

Aber jedes einzelne Brett ist dick und sie haben keine Lücken dazwischen, also sieht es gut aus.

+ some nessi generated image +

+ todays_audio.opus
+ +

+ + +

Site introduction:

+

stories about encountering problems and solving them

+ +
+

Text manipulation

+ +

Audio manipulation

+ +
+ +
+

+ + Contacts + +

+
+ + +
+ diff --git a/nessi_avatar.jpg b/nessi_avatar.jpg new file mode 100644 index 0000000..1b424a7 Binary files /dev/null and b/nessi_avatar.jpg differ diff --git a/nessi_generated.jpg b/nessi_generated.jpg new file mode 100644 index 0000000..d7bec3d Binary files /dev/null and b/nessi_generated.jpg differ diff --git a/replace_phrase.sh b/replace_phrase.sh new file mode 100755 index 0000000..1b61476 --- /dev/null +++ b/replace_phrase.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +# phrase=$(cat phrase) +phrase=${1:-"test phrase"} + +echo "$phrase" + +# if multiline +# https://stackoverflow.com/questions/10107459/replace-a-word-with-multiple-lines-using-sed/#22901380 +# escapedPhrase="$(echo "${phrase}" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/\$/\\$/g')" + +# just do oneline +phrase=$(echo $phrase | tr "\n" " ") + +sed -i -e "s|\(

\)\(.*\)\(

\)|\1${phrase}\3|" index.html diff --git a/todays_audio.opus b/todays_audio.opus new file mode 100644 index 0000000..1c19722 Binary files /dev/null and b/todays_audio.opus differ diff --git a/todays_audio.opus.json b/todays_audio.opus.json new file mode 100644 index 0000000..9b40607 --- /dev/null +++ b/todays_audio.opus.json @@ -0,0 +1 @@ +{"text": " Aber jedes einzelne Brett ist dick und sie haben keine L\u00fccken dazwischen, also sieht es gut aus.", "segments": [{"id": 0, "seek": 0, "start": 0.0, "end": 5.5200000000000005, "text": " Aber jedes einzelne Brett ist dick und sie haben keine L\u00fccken dazwischen, also sieht es gut aus.", "tokens": [50364, 5992, 36119, 36731, 716, 29447, 1418, 18659, 674, 2804, 3084, 9252, 441, 26037, 274, 921, 86, 6282, 11, 611, 14289, 785, 5228, 3437, 13, 50640], "temperature": 0.0, "avg_logprob": -0.22456582387288412, "compression_ratio": 1.0543478260869565, "no_speech_prob": 0.011318010278046131}], "language": "de"} \ No newline at end of file diff --git a/todays_audio.opus.srt b/todays_audio.opus.srt new file mode 100644 index 0000000..e3f0449 --- /dev/null +++ b/todays_audio.opus.srt @@ -0,0 +1,4 @@ +1 +00:00:00,000 --> 00:00:05,520 +Aber jedes einzelne Brett ist dick und sie haben keine Lücken dazwischen, also sieht es gut aus. + diff --git a/todays_audio.opus.tsv b/todays_audio.opus.tsv new file mode 100644 index 0000000..bb197e2 --- /dev/null +++ b/todays_audio.opus.tsv @@ -0,0 +1,2 @@ +start end text +0 5520 Aber jedes einzelne Brett ist dick und sie haben keine Lücken dazwischen, also sieht es gut aus. diff --git a/todays_audio.opus.txt b/todays_audio.opus.txt new file mode 100644 index 0000000..d61204e --- /dev/null +++ b/todays_audio.opus.txt @@ -0,0 +1 @@ +Aber jedes einzelne Brett ist dick und sie haben keine Lücken dazwischen, also sieht es gut aus. diff --git a/todays_audio.opus.vtt b/todays_audio.opus.vtt new file mode 100644 index 0000000..5ec228d --- /dev/null +++ b/todays_audio.opus.vtt @@ -0,0 +1,5 @@ +WEBVTT + +00:00.000 --> 00:05.520 +Aber jedes einzelne Brett ist dick und sie haben keine Lücken dazwischen, also sieht es gut aus. + diff --git a/update_index.sh b/update_index.sh new file mode 100755 index 0000000..f675188 --- /dev/null +++ b/update_index.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e + +dir=${1:-} + +filepath=$(du -a $dir | awk '($1 > 50) {print $2}' | shuf -n 1) +echo "$filepath" +mpv "$filepath" + +cp "$filepath" todays_audio.opus + +whisper --model medium --language de --device cpu todays_audio.opus + +phrase=$(cat todays_audio.opus.txt) +./replace_phrase.sh "$phrase" + +./get_sd_image.sh "$phrase" -- cgit v1.2.3