Add first proposal for a text summarize command. - annna - Annna the nice frien… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 2ba35242170d44325f8ee6b4540c2dc07d084aa1 | |
parent aaa888ea9fcd521ed0b172a911e14dde8e9404f1 | |
Author: Annna Robert-Houdin <[email protected]> | |
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(-) | |
--- | |
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-\x… | |
- -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 ::= ([… | |
+ -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 ::= ([… | |
+ -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 \ | |
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 | |
+ |