This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
install-christmais.sh
executable file
·167 lines (149 loc) · 4.55 KB
/
install-christmais.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/bin/bash
#
# Automated set-up script for christmAIs for any workspace
#
# Usage
# -----
# To use this script, simply run `./install-christmais.sh`
#
# Exit on error
set -e
finish() {
if (( $? != 0)); then
echo ""
echo "================================================"
echo "christmAIs did not install successfully"
echo "Please refer to manual setup instructions:"
echo "https://github.com/thinkingmachines/christmAIs"
echo "================================================"
echo ""
fi
}
trap finish EXIT
# For printing error messages
err() {
echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $*" >&2
exit 1
}
# Download important files
echo ""
echo "============================================"
echo "Downloading model checkpoint, categories, and"
echo "webdriver (chromedriver) "
echo "============================================"
echo ""
# Get categories.txt
if [ -f categories/categories.txt ]; then
echo "categories.txt exists! Skipping download..."
else
wget https://storage.googleapis.com/tm-christmais/categories.txt && \
mkdir categories && \
mv categories.txt categories/
fi
# Get model checkpoint
if [ -f ckpt/model.ckpt.index ]; then
echo "model checkpoint exists! Skipping download..."
else
wget https://storage.googleapis.com/download.magenta.tensorflow.org/models/arbitrary_style_transfer.tar.gz && \
mkdir ckpt && \
tar --strip-components 1 -xvzf arbitrary_style_transfer.tar.gz -C ckpt/
fi
# Get chromedriver
if [ -f webdriver/chromedriver ]; then
echo "chromedriver exists! Skipping download..."
else
wget https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip && \
mkdir webdriver && \
unzip chromedriver_*.zip -d webdriver
fi
echo ""
echo "============================================"
echo "Download success! The following files are "
echo "now stored in filesystem: "
echo "- categories: ./categories/categories.txt "
echo "- model.ckpt: ./ckpt/model.ckpt "
echo "- chromedriver: ./webdriver/chromedriver "
echo "============================================"
echo ""
# Download style images
echo ""
echo "============================================"
echo "Downloading style images from "
echo "Google Cloud Storage "
echo "============================================"
echo ""
# Sample style images
declare -a stylenames=(
"ang_kiukok.jpg"
"cassis.jpg"
"composition.jpg"
"dancer_flowers.jpg"
"impression_sunrise.jpg"
"la_grande_jatte.jpg"
"la_muse.jpg"
"marilyn_monroe.jpg"
"pila_sa_bigas.jpg"
"rain_princess.jpg"
"seated_nude.jpg"
"starry_night.jpg"
"the_scream.jpg"
"the_wave.jpg"
"tres_marias.jpg"
)
if ls styles/*.jpg 1> /dev/null 2>&1; then
echo "Style files exists!"
else
echo "Creating styles/ directory..."
mkdir styles;
for i in "${stylenames[@]}"
do
echo "Downloading $i into styles/..."
wget -P styles/ https://storage.googleapis.com/tm-christmais/styles/$i
done
fi
echo ""
echo "============================================"
echo "Download success! The following files are "
echo "now stored in filesystem: "
echo "- style images: ./styles/*.jpg "
echo "============================================"
echo ""
# Install rtmidi for realtime midi IO
if [[ $(which apt-get) ]]; then
echo ""
echo "============================================"
echo "installing rtmidi Linux library dependencies"
echo "sudo privileges required"
echo "============================================"
echo ""
sudo apt-get install build-essential libasound2-dev libjack-dev python3-dev tk-dev python-tk python3-tk
fi
pip install --pre python-rtmidi
if [[ $(which apt-get) ]]; then
echo ""
echo "============================================"
echo "installing chromium for the webdriver "
echo "sudo privileges required"
echo "============================================"
echo ""
sudo apt-get install chromium
fi
# Set up the magenta dependency
echo ""
echo "=============================="
echo "installing magenta dependency"
echo "=============================="
echo ""
pip install magenta
# Clone christmAIs repository
echo ""
echo "=============================="
echo "cloning christmAIs repository"
echo "=============================="
echo ""
python setup.py install
echo ""
echo "=============================="
echo "christmAIs Install Success!"
echo "=============================="
echo ""