forked from jantic/DeOldify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quick_start.sh
executable file
·51 lines (44 loc) · 1.61 KB
/
quick_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
46
47
48
49
50
51
#!/bin/bash
function usage {
echo '
_____ ____ _ _ _ __
| __ \ / __ \| | | (_)/ _|
| | | | ___| | | | | __| |_| |_ _ _
| | | |/ _ \ | | | |/ _` | | _| | | |
| |__| | __/ |__| | | (_| | | | | |_| |
|_____/ \___|\____/|_|\__,_|_|_| \__, |
__/ |
|___/
'
echo "usage : $0 notebook password -- to start the notebook with password"
echo " leave empty for no password (not recommended)"
echo "usage : $0 image_api -- to start image api"
echo "usage : $0 video_api -- to start video api"
echo ''
}
NOTEBOOK_PASSWORD=$2
if [ "$1" == "" ]; then
echo "missing first argument"
usage
else
#handling non GPU accelerated hardware
# if nvidia-smi not found => no ipc host
# --ipc=host
if nvidia-smi; then
IPC_HOST="--ipc=host"
echo "nvidia card found running on GPU"
else
IPC_HOST=""
echo "No nvidia card found running on CPU"
fi
already_built=$(rm -rf /tmp/deoldify.built; if docker image ls | grep deoldify > /tmp/deoldify.built; then echo "ok"; else echo "not ok"; fi; rm -rf /tmp/deoldify.built)
if [ "$already_built" == "ok" ]; then
echo "Docker started from cache"
echo "Access your $1 on port 5000 (api) or 8888 (notebook)"
docker run -it -p 8888:8888 -p 5000:5000 -e NOTEBOOK_PASSWORD=$NOTEBOOK_PASSWORD deoldify run_$1
else
docker build -t deoldify -f Dockerfile . && docker run -it -p 8888:8888 -p 5000:5000 -e NOTEBOOK_PASSWORD=$NOTEBOOK_PASSWORD deoldify run_$1
echo "Docker build and started"
echo "Access your $1 on port 5000 (api) or 8888 (notebook)"
fi
fi