forked from machinewrapped/llm-subtrans
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·48 lines (39 loc) · 1.41 KB
/
install.sh
File metadata and controls
executable file
·48 lines (39 loc) · 1.41 KB
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
46
47
48
#!/bin/bash
echo "Checking if Python 3 is installed..."
command -v python3 >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Python 3 not found. Please install Python 3 and try again."
exit 1
fi
echo "Checking if 'envsubtrans' folder exists..."
if [ -d "envsubtrans" ]; then
echo "'envsubtrans' folder exists. Please delete it to continue with the installation."
exit 1
fi
echo "Creating and activating virtual environment 'envsubtrans'..."
python3 -m venv envsubtrans
source envsubtrans/bin/activate
echo "Installing requirements from 'requirements.txt'..."
pip install -r requirements.txt
if [ ! -f ".env" ]; then
echo "Please enter your OpenAI API key:"
read -r api_key
echo "API_KEY=$api_key" > .env
echo "API key saved to .env"
fi
echo "Please enter your OpenAI API host(Leave blank for default: https://api.openai.com/v1):"
read -r api_base
if [ ! -z "$api_base" ]; then
echo "API_BASE=$api_base" >> .env
echo "API base saved to .env"
fi
echo "Are you on the free plan? (Y/N)"
read -r free_plan
if [[ "${free_plan^^}" == "Y" ]] || [[ "${free_plan^^}" == "YES" ]]; then
echo "MAX_THREADS=1" >> .env
echo "RATE_LIMIT=5" >> .env
echo "Warning: Translation speed will be severely limited due to the free plan limitations."
echo "If you upgrade your plan, rerun the script to update your settings."
fi
echo "Installation complete."
echo "To uninstall, simply delete the directory."