GhostLlama / install.sh
masterknuta's picture
Upload install.sh with huggingface_hub
ed0d8b4 verified
#!/bin/bash
# Colors
PURPLE='\033[0;35m'
TEAL='\033[0;36m'
NC='\033[0m'
echo ' ... ...'
echo ' -*%##: .=#=.'
echo ' *# ##=::=###:'
echo ' -%# ## ## ###:'
echo ' .=# ########## .'
echo ' :# ## ##### #+'
echo ' .= #############+.'
echo ' .## ##### ### #+###.'
echo ' .# ####### ###.'
echo ' .# #############=.'
echo ' :## ########%*'
echo ' :# ######## ##*'
echo ' ...........:=########### #:'
echo ' .....:+ ####################### #.'
echo ' .:= # ########################### #:'
echo ' .=# # ########################### #=.'
echo ' ...:+ # ############################# ##.'
echo ' :=# # # ############################# ##.'
echo ' ....:=# ############################ ##.'
echo ' :# ########################## ##=.'
echo ' .=# ########################## #-'
echo ' *# ########################### #'
echo ' * ##### # ########## #='
echo ' =# #### # ######## #'
echo ' * ##### # ###### # #+.'
echo ' * ###### #%- =# ####### @'
echo ' .:= ##===###=- .= ###### #=-'
echo ' .=# ##=. :%+: .=# #===# %*'
echo ' .+:... .##=:: ....'
echo ' ...'
# Header
echo -e "${PURPLE}"
echo "╔══════════════════════════════════════╗"
echo "β•‘ πŸ‘» GhostLlama INSTALLER v1.1 β•‘"
echo "β•‘ πŸ“– How to Sacrifice your Llama β•‘"
echo "β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•"
echo -e "${NC}"
# Updates
echo -e "${TEAL} v1.1 Added ghostchat terminal command and Updated Telegram Integration.${NC}"
# Create directories
echo -e "${TEAL}[🟣] Preparing the altar...${NC}"
mkdir -p ~/ghostllama/models
mkdir -p ~/ghostllama/config
# Download model
echo -e "${TEAL}[🟣] Summoning the spirit from HuggingFace...${NC}"
cd ~/ghostllama/models
wget -O ghostllama.Q4_K_M.gguf https://huggingface.co/Acvarius-AI/GhostLlama/resolve/main/ghostllama.Q4_K_M.gguf
# Add terminal chat command
echo "alias ghostchat='~/llama.cpp/build/bin/llama-cli -m ~/ghostllama/models/ghostllama.Q4_K_M.gguf -cnv'" >> ~/.bashrc
echo -e "${TEAL}[🟣] Terminal chat ready! Type 'ghostchat' to talk to GhostLlama.${NC}"
# Telegram setup
echo -e "${TEAL}[🟣] Connect to Telegram? (y/n)${NC}"
read -r telegram
if [ "$telegram" = "y" ]; then
echo -e "${TEAL}[🟣] Enter your Telegram Bot Token:${NC}"
read -r token
echo "TELEGRAM_BOT_TOKEN=$token" > ~/ghostllama/config/telegram.conf
# Create basic bot script
cat > ~/ghostllama/telegram-bot.py << 'EOF'
import requests
import subprocess
import time
import os
TOKEN = open(os.path.expanduser('~/ghostllama/config/telegram.conf')).read().split('=')[1].strip()
URL = f"https://api.telegram.org/bot{TOKEN}"
def get_updates(offset=None):
url = f"{URL}/getUpdates"
params = {"timeout": 100, "offset": offset}
response = requests.get(url, params=params)
return response.json()
def send_message(chat_id, text):
url = f"{URL}/sendMessage"
params = {"chat_id": chat_id, "text": text}
requests.post(url, params=params)
def call_model(prompt):
# Expand paths so they work from ANY directory
llama_cli = os.path.expanduser("~/llama.cpp/build/bin/llama-cli")
model_path = os.path.expanduser("~/ghostllama/models/ghostllama.Q4_K_M.gguf")
result = subprocess.run(
[llama_cli, "-m", model_path, "-p", prompt, "-n", "50"],
capture_output=True,
text=True
)
return result.stdout
last_update = 0
while True:
updates = get_updates(last_update + 1)
if "result" in updates:
for update in updates["result"]:
last_update = update["update_id"]
if "message" in update and "text" in update["message"]:
chat_id = update["message"]["chat"]["id"]
user_text = update["message"]["text"]
response = call_model(user_text)
send_message(chat_id, response)
time.sleep(1)
EOF
echo -e "${TEAL}[🟣] Telegram bot installed! Run with: python ~/ghostllama/telegram-bot.py${NC}"
fi
# Done
echo -e "${PURPLE}"
echo "╔══════════════════════════════════════╗"
echo "β•‘ ✨ SACRIFICE COMPLETE ✨ β•‘"
echo "β•‘ Run 'cd ~/ghostllama' to begin β•‘"
echo "β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•"
echo -e "${NC}"