Skip to content

Instantly share code, notes, and snippets.

@sheh
Last active March 4, 2019 20:45
Show Gist options
  • Save sheh/ca6dd5e68adf8a18068cb174134383f8 to your computer and use it in GitHub Desktop.
Save sheh/ca6dd5e68adf8a18068cb174134383f8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
VERSION=$1
CMD_FILE=~/Desktop/ew-demo.command
DEMO_DIR=~/.ew_demo
VENV_DIR=${DEMO_DIR}/venv
if [[ -z "${PYPI_AUTH}" ]]
then
echo "Run 'export PYPI_AUTH=<login>:<pass>' "
exit 1
else
echo ""
fi
if which brew >/dev/null; then
echo "brew already installed"
else
echo "Install brew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo "Install opencv"
brew install opencv
if which python3.6 >/dev/null; then
echo "python3.6 already installed"
else
echo "Install python3.6 and curl"
brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
brew install curl
fi
echo "Create virtual env"
mkdir -p ${DEMO_DIR}
cd ${DEMO_DIR}
rm -rf ${VENV_DIR}
python3.6 -m venv ${VENV_DIR}
PY=${DEMO_DIR}/venv/bin/python
PIP=${DEMO_DIR}/venv/bin/pip
echo "Install packages"
${PIP} install opencv-python
${PIP} install --no-cache-dir --index-url https://${PYPI_AUTH}@pypi.aigebra.eu/ -U --force tensorflow
${PIP} install --no-deps --no-cache-dir --extra-index-url https://${PYPI_AUTH}@pypi.aigebra.eu/ -U --force ew-demo-tf
echo "Make links"
ln -sf ${VENV_DIR}/ew-demo-data/ ${DEMO_DIR}/models
ln -sf ${VENV_DIR}/ew-demo-data/demo-default-tf.cfg .
echo "#!/bin/bash" > ${CMD_FILE}
echo "cd "${DEMO_DIR} >> ${CMD_FILE}
echo ${PY}" "${VENV_DIR}"/bin/run.py -c demo-default-tf.cfg" >> ${CMD_FILE}
chmod +x ${CMD_FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment