Add first proposal for a text summarize command. - 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 2ba35242170d44325f8ee6b4540c2dc07d084aa1
DIR parent aaa888ea9fcd521ed0b172a911e14dde8e9404f1
HTML Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Wed, 15 Jan 2025 13:41:00 +0100
Add first proposal for a text summarize command.
Diffstat:
M gpt | 19 ++++++++++++++-----
A summarize | 9 +++++++++
2 files changed, 23 insertions(+), 5 deletions(-)
---
DIR diff --git a/gpt b/gpt
@@ -18,11 +18,20 @@ then
fi
prompt="$1"
-printf "%s\n" "${prompt}" \
- | $ggmlbin -m $ggmlmodel -n $ggmlntokens -t 3 \
- --simple-io --no-display-prompt --grammar 'root ::= ([^\x00-\x1F])*' \
- -p "${systemprompt}" -cnv 2>/dev/null \
- | sed -E '/^$/d;s/^>[[:blank:]]+//;q'
+if [ -z "$prompt" ];
+then
+ cat \
+ | $ggmlbin -m $ggmlmodel -n $ggmlntokens -t 3 \
+ --simple-io --no-display-prompt --grammar 'root ::= ([^\x00-\x1F])*' \
+ -cnv 2>/dev/null \
+ | sed -E '/^$/d;s/^>[[:blank:]]+//;q'
+else
+ printf "%s\n" "${prompt}" \
+ | $ggmlbin -m $ggmlmodel -n $ggmlntokens -t 3 \
+ --simple-io --no-display-prompt --grammar 'root ::= ([^\x00-\x1F])*' \
+ -cnv 2>/dev/null \
+ | sed -E '/^$/d;s/^>[[:blank:]]+//;q'
+fi
#$ggmlbin -m $ggmlmodel -n $ggmlntokens \
# --simple-io --no-display-prompt --grammar 'root ::= ([^\x00-\x1F])*' \
# -p "$1" 2>/dev/null \
DIR diff --git a/summarize b/summarize
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+export PATH="$HOME/bin:$PATH"
+
+{
+ printf "Please summarize following text:"
+ cat | tr '\n' ' ' | sed 's/ */ /g'
+} | gpt
+