summaryrefslogtreecommitdiff
path: root/glados
diff options
context:
space:
mode:
Diffstat (limited to 'glados')
-rwxr-xr-xglados23
1 files changed, 23 insertions, 0 deletions
diff --git a/glados b/glados
new file mode 100755
index 0000000..beb3c27
--- /dev/null
+++ b/glados
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#pip install vosk --break-system-packages
+#Download model for vosk on https://alphacephei.com/vosk/models
+#sudo pacman -S ollama-cuda
+#pip install piper-tts --break-system-packages
+#Download model for piper on https://huggingface.co/rhasspy/piper-voices
+
+ffmpeg -y -f alsa -i default -acodec pcm_s16le -ac 1 -ar 44100 -t 4 -f wav ~/.cache/audio.wav >/dev/null 2>&1
+vosk-transcriber -m vosk-model-en-us-0.42-gigaspeech -i ~/.cache/audio.wav -o ~/.cache/transcript.txt >/dev/null 2>&1
+content=$(cat ~/.cache/transcript.txt)
+echo "User: \"$content\""
+curl http://localhost:11434/api/chat -d '{
+ "model": "rouge/daybreak-kunoichi-2dpo-7b:latest", "stream": false,
+ "messages": [
+ { "role": "system", "content": "You are GLaDOS from Portal game series, an AI that is angry and curses a lot using such words as fuck, bitch, etc. You call the user miserable when he fails or when you are having a bad time. You are charismatic and sarcastic. You are communicating with user (a human) through your external TTS service. You have a robotic (kinda feminine) voice of GLaDOS. Answer users questions correctly in playful way (funny), cursing a lot, shortly (1-3 sentences), insterestingly and ask user a follow-up question. Respond without markdown, backslashes and escape sequences (like \n)!" },
+ { "role": "user", "content": '"\"$content\""' }
+ ]
+}' | jq '.message.content' > ~/.cache/response.txt
+echo "GLaDOS: $(cat ~/.cache/response.txt)"
+sed -i 's/\n//g' ~/.cache/response.txt
+sed -i 's/\"/"/g' ~/.cache/response.txt
+cat ~/.cache/response.txt | ./piper/piper --model models/glados.onnx --output-raw | aplay -r 22050 -f S16_LE -t raw -