Spaces:
Running
Running
File size: 1,293 Bytes
80bd2d9 cab2013 80bd2d9 cab2013 80bd2d9 cab2013 d61ee9c e2f1fe1 80bd2d9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #!/bin/bash
cd "$(dirname "$0")"
source ~/.bashrc
# Check if PID file exists AND process is actually running
if [ -f deepshell.pid ]; then
PID=$(cat deepshell.pid)
if kill -0 $PID 2>/dev/null; then
echo "DeepShell already running (PID $PID)"
exit 1
else
echo "Stale PID found, cleaning up..."
rm -f deepshell.pid
fi
fi
# Start LibreTranslate if not already running
if ! pgrep -f "libretranslate" > /dev/null; then
source ~/.venvs/libretranslate/bin/activate
nohup libretranslate --host 0.0.0.0 --port 5000 --load-only en,hi > libretranslate.log 2>&1 &
echo $! > libretranslate.pid
echo "LibreTranslate started (PID $(cat libretranslate.pid))"
deactivate
# Warmup — trigger model load in background
sleep 5 && curl -s -X POST http://localhost:5000/translate -H "Content-Type: application/json" -d '{"q":"warmup","source":"en","target":"hi"}' > /dev/null 2>&1 &
echo "LibreTranslate warmup triggered"
else
echo "LibreTranslate already running"
fi
# Explicitly pass GROQ_API_KEY to subprocess
GROQ_API_KEY=$GROQ_API_KEY nohup python run_deepshell.py > deepshell.log 2>&1 &
echo $! > deepshell.pid
echo "DeepShell started (PID $(cat deepshell.pid))"
echo "Logs: tail -f $(pwd)/deepshell.log"
|