# MegaPixels FaceQuery.me, mozilla, nytimes ## Installation - miniconda / python3.6 - mysql - nvm, node - redis - nginx ``` conda create -n megapixels python=3.6 conda install pytorch torchvision -c pytorch conda install faiss-cpu -c pytorch conda install tensorflow pip install numpy Pillow pip install dlib pip install requests simplejson click pdfminer.six pip install urllib3 flask flask_sqlalchemy mysql-connector pip install pymediainfo tqdm opencv-python imutils pip install scikit-image python-dotenv imagehash scikit-learn colorlog pip install celery keras tensorflow pip install python.app # OSX only! needed for matplotlib sudo apt-get install libmysqlclient-dev mkdir -p /data_store_hdd/apps/megapixels/faiss/indexes mkdir -p /data_store_hdd/apps/megapixels/faiss/metadata ``` ### MySQL note You may need to set the database charset to `utf8mb4` in order to import the CSVs: ``` ALTER DATABASE megapixels CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ``` ## Building the site The most recently built copy of the site is kept in the repo. This is generated directly from NextCloud. Be mindful that NextCloud will create extra copies of things if there are merge conflicts. ``` npm install npm run build cd megapixels python cli_faiss.py sync_metadata python cli_faiss.py build_faiss python cli_faiss.py build_db python cli_site.py build ``` ## Running the site On OSX, you must run `pythonw` to use matplotlib. ``` python cli_flask.py run python `which celery` worker -A app.server.tasks --loglevel=info -E redis-server /usr/local/etc/redis.conf npm run watch ```