Skip to content

Commit

Permalink
add quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
jqueguiner committed Nov 17, 2020
1 parent b52d786 commit 19aa9f0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api_cmd_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ echo "usage : $0 image -- to test image api"
echo "usage : $0 video -- to test video api"
echo ''
echo 'you can add non mandatory arguments'
echo "usage : $0 image $port $host -- for custom port or host"
echo "usage : $0 image port host -- for custom port or host"
echo ''
echo ''

Expand Down
26 changes: 24 additions & 2 deletions quick_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function usage {
echo "usage : $0 video_api -- to start video api"
echo ''
echo 'you can add non mandatory arguments'
echo "usage : $0 image_api $port $host -- for custom port or host"
echo "usage : $0 image_api port host -- for custom port or host"
echo ''
echo ''
}
Expand All @@ -28,6 +28,28 @@ if [ "$1" == "" ]; then
echo "missing first argument"
usage
else
docker run -d -p 8888:8888 -p 5000:5000 -e NOTEBOOK_PASSWORD=$NOTEBOOK_PASSWORD deoldify run_$1 || docker build -t deoldify -f Dockerfile . && docker run -it -p 8888:8888 -p 5000:5000 -e NOTEBOOK_PASSWORD=$NOTEBOOK_PASSWORD deoldify run_$1
#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

0 comments on commit 19aa9f0

Please sign in to comment.