forked from Luxadevi/Ollama-Companion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
45 lines (37 loc) · 982 Bytes
/
start.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
44
45
#!/bin/bash
# Run this script with the arguments -lan or -local to start the companion without
# Generating a Public URL.
# Get the directory of this script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Change to the script's directory
cd "$SCRIPT_DIR"
# Launch virtual environment
source companion_venv/bin/activate
echo "started virtual env"
start_locally() {
echo "starting Ollama-Companion locally on port 8501"
streamlit run Homepage.py
}
start_public() {
pgrep -f '.*tunnel.*127\.0\.0\.1:8501.*' | xargs -r kill -9
echo "starting Ollama-Companion with a public URL"
python3 run_tunnel.py &
sleep 3
streamlit run Homepage.py
}
# Default function to start_public
function_to_run=start_public
# Parse arguments
for arg in "$@"
do
case $arg in
-local|-lan)
function_to_run=start_locally
break
;;
*)
;;
esac
done
# Run the selected function
$function_to_run