From 9730aa5c050352736327a992f9a428b6bc82cd75 Mon Sep 17 00:00:00 2001 From: Shyam Sunder Date: Sat, 21 Jul 2018 15:58:52 -0400 Subject: [PATCH] client: clean up required Python packages * Packages that are only used in testing or development have been moved to `dev-requirements.txt` * Closes #178 * Minor rewrite to drop the `scikit-image` package, which saves around 200MB in install size --- server/dev-requirements.txt | 4 ++++ server/requirements.txt | 12 ++++-------- server/szurubooru/func/image_hash.py | 4 +--- 3 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 server/dev-requirements.txt diff --git a/server/dev-requirements.txt b/server/dev-requirements.txt new file mode 100644 index 0000000..c9dc234 --- /dev/null +++ b/server/dev-requirements.txt @@ -0,0 +1,4 @@ +pytest>=2.9.1 +pytest-cov>=2.2.1 +freezegun>=0.3.6 +pycodestyle>=2.0.0 diff --git a/server/requirements.txt b/server/requirements.txt index b11c3b5..a1ef52e 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -1,16 +1,12 @@ alembic>=0.8.5 pyyaml>=3.11 -psycopg2>=2.6.1 +psycopg2-binary>=2.6.1 SQLAlchemy>=1.0.12 -pytest>=2.9.1 -pytest-cov>=2.2.1 -freezegun>=0.3.6 coloredlogs==5.0 -pycodestyle>=2.0.0 -scipy>=0.18.1 elasticsearch>=5.0.0 elasticsearch-dsl>=5.0.0 -scikit-image>=0.12 +numpy>=1.8.2 +pillow>=4.3.0 pynacl>=1.2.1 pytz>=2018.3 -pyRFC3339>=1.0 \ No newline at end of file +pyRFC3339>=1.0 diff --git a/server/szurubooru/func/image_hash.py b/server/szurubooru/func/image_hash.py index dae8443..b89b218 100644 --- a/server/szurubooru/func/image_hash.py +++ b/server/szurubooru/func/image_hash.py @@ -5,7 +5,6 @@ from typing import Any, Optional, Tuple, Set, List, Callable import elasticsearch import elasticsearch_dsl import numpy as np -from skimage.color import rgb2gray from PIL import Image from szurubooru import config, errors @@ -41,8 +40,7 @@ def _get_session() -> elasticsearch.Elasticsearch: def _preprocess_image(content: bytes) -> NpMatrix: img = Image.open(BytesIO(content)) - img = img.convert('RGB') - return rgb2gray(np.asarray(img, dtype=np.uint8)) + return np.asarray(img.convert('L'), dtype=np.uint8) def _crop_image(