forked from ParisNeo/lollms-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webui.sh
122 lines (107 loc) · 3.76 KB
/
webui.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env bash
echo "\u001b[34m"
echo " ___ ___ ___ ___ ___ ___ "
echo " /\__\ /\ \ /\__\ /\__\ /\__\ /\ \ "
echo " /:/ / /::\ \ /:/ / /:/ / /::| | /::\ \ "
echo " /:/ / /:/\:\ \ /:/ / /:/ / /:|:| | /:/\ \ \ "
echo " /:/ / /:/ \:\ \ /:/ / /:/ / /:/|:|__|__ _\:\~\ \ \ "
echo " /:/__/ /:/__/ \:\__\ /:/__/ /:/__/ /:/ |::::\__\ /\ \:\ \ \__\ "
echo " \:\ \ \:\ \ /:/ / \:\ \ \:\ \ \/__/~~/:/ / \:\ \:\ \/__/ "
echo " \:\ \ \:\ /:/ / \:\ \ \:\ \ /:/ / \:\ \:\__\ "
echo " \:\ \ \:\/:/ / \:\ \ \:\ \ /:/ / \:\/:/ / "
echo " \:\__\ \::/ / \:\__\ \:\__\ /:/ / \::/ / "
echo " \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ "
echo " By ParisNeo"
echo "\u001b[0m"
if ping -q -c 1 google.com >/dev/null 2>&1; then
echo -e "\e[32mInternet Connection working fine\e[0m"
# Install git
echo -n "Checking for Git..."
if command -v git > /dev/null 2>&1; then
echo "is installed"
else
read -p "Git is not installed. Would you like to install Git? [Y/N] " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
echo "Installing Git..."
sudo apt update
sudo apt install -y git
else
echo "Please install Git and try again."
exit 1
fi
fi
# Check if repository exists
if [[ -d .git ]] ;then
echo Pulling latest changes
git pull
else
if [[ -d lollms-webui ]] ;then
cd lollms-webui
else
echo Cloning repository...
rem Clone the Git repository into a temporary directory
git clone https://github.com/ParisNeo/lollms-webui.git ./lollms-webui
cd lollms-webui
fi
fi
echo Pulling latest version...
git pull
# Install Python 3.10 and pip
echo -n "Checking for python3..."
if command -v python3 > /dev/null 2>&1; then
echo "is installed"
else
read -p "python3 is not installed. Would you like to install python3? [Y/N] " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
echo "Installing python3..."
sudo apt update
sudo apt install -y python3 python3-venv
else
echo "Please install python3 and try again."
exit 1
fi
fi
# Install venv module
echo -n "Checking for venv module..."
if python3 -m venv env > /dev/null 2>&1; then
echo "is installed"
else
read -p "venv module is not available. Would you like to install it? [Y/N] " choice
if [ "$choice" = "Y" ] || [ "$choice" = "y" ]; then
echo "Installing venv module..."
sudo apt update
sudo apt install -y python3-venv
else
echo "Please install venv module and try again."
exit 1
fi
fi
# Create a new virtual environment
echo -n "Creating virtual environment..."
python3 -m venv env
if [ $? -ne 0 ]; then
echo "Failed to create virtual environment. Please check your Python installation and try again."
exit 1
else
echo "is created"
fi
fi
# Activate the virtual environment
echo -n "Activating virtual environment..."
source env/bin/activate
echo "is active"
# Install the required packages
echo "Installing requirements..."
python3 -m pip install pip --upgrade
python3 -m pip install --upgrade -r requirements.txt
if [ $? -ne 0 ]; then
echo "Failed to install required packages. Please check your internet connection and try again."
exit 1
fi
# Cleanup
if [ -d "./tmp" ]; then
rm -rf "./tmp"
echo "Cleaning tmp folder"
fi
# Launch the Python application
python app.py "$@"