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
This commit is contained in:
Shyam Sunder 2018-07-21 15:58:52 -04:00 committed by rr-
parent 1fe22a4d0a
commit 9730aa5c05
3 changed files with 9 additions and 11 deletions

View file

@ -0,0 +1,4 @@
pytest>=2.9.1
pytest-cov>=2.2.1
freezegun>=0.3.6
pycodestyle>=2.0.0

View file

@ -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
pyRFC3339>=1.0

View file

@ -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(