-
Notifications
You must be signed in to change notification settings - Fork 10
/
setup.sh
75 lines (61 loc) · 2.11 KB
/
setup.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
#!/bin/bash
# Exit on error
set -e
# Update and upgrade system packages
echo "Updating and upgrading system packages..."
sudo apt update && sudo apt upgrade -y
# Install required packages
echo "Installing required packages..."
sudo apt install -y ffmpeg curl git
# Clone the DeOldify repository
if [ ! -d "DeOldify" ]; then
echo "Cloning DeOldify repository..."
git clone https://github.com/jantic/DeOldify.git DeOldify
else
echo "DeOldify repository already exists."
fi
# Navigate to the DeOldify directory
cd DeOldify
# Download and install Miniconda
if [ ! -f "Miniconda3-latest-Linux-x86_64.sh" ]; then
echo "Downloading Miniconda installer..."
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
else
echo "Miniconda installer already downloaded."
fi
echo "Installing Miniconda..."
sudo chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b -p ~/miniconda3
rm Miniconda3-latest-Linux-x86_64.sh
# Update PATH and initialize conda
if ! grep -q 'miniconda3/bin' ~/.bashrc; then
echo "Updating PATH for Miniconda..."
echo 'export PATH=~/miniconda3/bin:$PATH' | sudo tee -a ~/.bashrc
fi
source ~/.bashrc
if ! ~/miniconda3/bin/conda info --envs | grep -q 'deoldify'; then
echo "Initializing Conda..."
~/miniconda3/bin/conda init
fi
# Create the conda environment
echo "Creating Conda environment..."
~/miniconda3/bin/conda env create -f environment.yml
# Install Jupyter core
echo "Installing Jupyter core..."
sudo apt install -y jupyter-core
# Download the model file
MODEL_PATH="models/ColorizeArtistic_gen.pth"
if [ ! -f "$MODEL_PATH" ]; then
echo "Downloading model file..."
curl -L https://huggingface.co/spaces/aryadytm/photo-colorization/resolve/main/models/ColorizeArtistic_gen.pth?download=true -o $MODEL_PATH
else
echo "Model file already exists."
fi
# Print the contents of the instructions file
echo
if [ -f "run_one_by_one_to_start_first_time.txt" ]; then
echo "------READ THIS------"
cat run_one_by_one_to_start_first_time.txt
else
echo "Instructions file 'run_one_by_one_to_start_first_time.txt' not found."
fi