merged all Raycast Scripts
This commit is contained in:
48
AI/image-caption-and-hashtags.sh
Executable file
48
AI/image-caption-and-hashtags.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Required parameters:
|
||||
# @raycast.schemaVersion 1
|
||||
# @raycast.title Generate Instagram Caption and Hashtags for image
|
||||
# @raycast.mode silent
|
||||
# @raycast.packageName MrRaph_ AI
|
||||
#
|
||||
# Optional parameters:
|
||||
# @raycast.icon 📸
|
||||
#
|
||||
# Documentation:
|
||||
# @raycast.description This script get selected image's path, generate caption and hashtags for it
|
||||
# @raycast.author Jakub Lanski
|
||||
# @raycast.authorURL https://github.com/jaklan
|
||||
|
||||
imagePath=$(osascript -e 'tell application "Finder"
|
||||
set selectedFiles to selection
|
||||
if (count of selectedFiles) is 0 then
|
||||
return "No file selected"
|
||||
else
|
||||
set selectedFile to item 1 of selectedFiles
|
||||
set filePath to POSIX path of (selectedFile as text)
|
||||
return filePath
|
||||
end if
|
||||
end tell')
|
||||
|
||||
source $(dirname $0)/include.sh
|
||||
|
||||
nl=$'\n'
|
||||
|
||||
(
|
||||
echo '<|begin_of_text|><|start_header_id|>system<|end_header_id|>'
|
||||
echo "Give a short, accurate and fun caption for the picture. Give a list of 9 trending hashtags that suits with the given description. Give only the caption and hashtags list, don't say anything else. Output must be made in French. Based on following image description :"
|
||||
$LLAMAFILES_PATH/llava-v1.5-7b-q4.llamafile --temp 0.2 --image "$imagePath" -e -p "### User: Describe the image as accurately and in as much detail as possible. Don't try to make up details or information you don't know. Don't hesitate to make a description as log as possible to best describe the picture.\n### Assistant:" --no-display-prompt 2>/dev/null
|
||||
echo '<|eot_id|>{{history}}<|start_header_id|>{{char}}<|end_header_id|>'
|
||||
) | $LLAMAFILES_PATH/Meta-Llama-3-8B-Instruct.Q5_K_M.llamafile -ngl 9999 \
|
||||
-f /dev/stdin \
|
||||
-c 0 \
|
||||
--temp 0 \
|
||||
-n 500 \
|
||||
--no-display-prompt 2>/dev/null | sed 's/<|start_header_id|>assistant<|end_header_id|>//' | sed -r '/^\s*$/d' | sed 's/<|eot_id|>//' | sed 's/"//g' | sed '1 a\
|
||||
-\
|
||||
-
|
||||
' | pbcopy
|
||||
|
||||
|
||||
echo "Copied"
|
||||
1
AI/include.sh
Normal file
1
AI/include.sh
Normal file
@@ -0,0 +1 @@
|
||||
export LLAMAFILES_PATH=/Users/mrraph/AI/llamafiles
|
||||
Reference in New Issue
Block a user