-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathollama.sh
executable file
·43 lines (34 loc) · 884 Bytes
/
ollama.sh
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
37
38
39
40
41
42
43
#!/bin/bash
check_dependencies() {
local dependencies=("bash" "python3" "fzf")
local missing=()
for dep in "${dependencies[@]}"; do
command -v "$dep" >/dev/null 2>&1 || missing+=("$dep")
done
if [ "${#missing[@]}" -eq 0 ]; then
echo "All dependencies satisfied."
else
echo "The following dependencies are missing: ${missing[*]}"
read -p "Press any key to exit." -n 1 -r
echo
exit 1
fi
}
cleanup() {
# Terminate ollama process if it's running
if pgrep -x "ollama" >/dev/null; then
echo "Terminating ollama process..."
pkill -x "ollama"
fi
}
trap cleanup EXIT
check_dependencies
WORKDIR="$HOME/Documents/Github/ollama-webui/backend/"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$WORKDIR/lib/python3.12/site-packages/
PORT="${1-8000}"
webui() {
cd "$WORKDIR" || exit
source bin/activate
ollama serve | bash start.sh
}
webui