diff --git a/README.md b/README.md index d43e151..d7c869f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,36 @@ # NLPService Microservice that does word and emoji prediction + +## Installation +Using Anaconda or Miniconda, create an environment with the packages listed in ```environment.yml``` with +``` +conda env create -n nlp-service -f environment.yml +``` +This creates a new conda environment named ```nlp-service```. + +## Usage +Activate the conda environment. + +__Server side__: run ```python main.py``` to start the server. + +__Client side__: connect to the server with SocketIO client and emit "predict" with a word or phrase as an argument to get word predictions. Example for predicting "a": + +``` +from socketIO_client import SocketIO + +# The code below is to simulate requests from the client +def callback_func(*args): + print("predictions: ", args) + +# server running on localhost:8001 +socket_client = SocketIO("localhost", 8001) +socket_client.connect() +socket_client.emit("predict", "a", callback_func) +socket_client.wait_for_callbacks(seconds=1) +``` +Will print: +``` +predictions: ('and', 'at', 'as') +``` + +This example was taken from ```complete.py```. diff --git a/src/environment.yml b/src/environment.yml index 0103320..15d758c 100644 --- a/src/environment.yml +++ b/src/environment.yml @@ -1,61 +1,67 @@ -name: nlp_service +name: mindtype channels: + - anaconda + - conda-forge - defaults dependencies: - - astroid=2.0.4=py35_0 + - ca-certificates=2019.1.23=0 + - certifi=2018.11.29=py36_0 + - openssl=1.1.1=he774522_0 + - pandas=0.24.1=py36ha925a31_0 + - pytz=2018.9=py36_0 + - vc=14.1=h21ff451_3 + - vs2015_runtime=15.5.2=3 + - aiofiles=0.4.0=py_1001 + - cycler=0.10.0=py_1 + - freetype=2.9.1=h5db478b_1005 + - httptools=0.0.11=py36hfa6e2cd_1000 + - jpeg=9c=hfa6e2cd_1001 + - kiwisolver=1.0.1=py36he980bc4_1002 + - libpng=1.6.36=h7602738_1000 + - matplotlib=3.0.2=py36_1002 + - matplotlib-base=3.0.2=py36h3e3dc42_1002 + - mkl_fft=1.0.10=py36hfa6e2cd_1 + - mkl_random=1.0.2=py36h830ac7b_2 + - multidict=4.5.2=py36hfa6e2cd_1000 + - pip=19.0.2=py36_0 + - pyparsing=2.3.1=py_0 + - python=3.6.6=he025d50_0 + - python-dateutil=2.8.0=py_0 + - python-engineio=3.0.0=py_0 + - python-marisa-trie=0.7.4=py36h6538335_1 + - python-socketio=3.1.2=py_0 + - sanic=18.12.0=py36_1000 + - setuptools=40.8.0=py36_0 + - sip=4.19.8=py36h6538335_1000 + - six=1.12.0=py36_1000 + - sqlite=3.26.0=hfa6e2cd_1000 + - tornado=5.1.1=py36hfa6e2cd_1000 + - websockets=5.0.1=py36hfa6e2cd_1000 + - wheel=0.33.1=py36_0 + - wincertstore=0.2=py36_1002 + - zlib=1.2.11=h2fa13f4_1004 - blas=1.0=mkl - - ca-certificates=2018.03.07=0 - - certifi=2018.8.24=py35_1 - - intel-openmp=2019.0=118 - - isort=4.3.4=py35_0 - - lazy-object-proxy=1.3.1=py35h14c3975_2 - - libedit=3.1.20170329=h6b74fdf_2 - - libffi=3.2.1=hd88cf55_4 - - libgcc-ng=8.2.0=hdf63c60_1 - - libgfortran-ng=7.3.0=hdf63c60_0 - - libstdcxx-ng=8.2.0=hdf63c60_1 - - mccabe=0.6.1=py35_1 - - mkl=2019.0=118 - - mkl_fft=1.0.4=py35h4414c95_1 - - mkl_random=1.0.1=py35h4414c95_1 - - ncurses=6.1=hf484d3e_0 - - numpy=1.15.1=py35h1d66e8a_0 - - numpy-base=1.15.1=py35h81de0dd_0 - - openssl=1.0.2p=h14c3975_0 - - pandas=0.23.4=py35h04863e7_0 - - pip=10.0.1=py35_0 - - pylint=2.1.1=py35_0 - - python=3.5.6=hc3d631a_0 - - python-dateutil=2.7.3=py35_0 - - pytz=2018.5=py35_0 - - readline=7.0=h7b6447c_5 - - setuptools=40.2.0=py35_0 - - six=1.11.0=py35_1 - - sqlite=3.24.0=h84994c4_0 - - tk=8.6.8=hbc83047_0 - - typed-ast=1.1.0=py35h20cf15d_0 - - wheel=0.31.1=py35_0 - - wrapt=1.10.11=py35h14c3975_2 - - xz=5.2.4=h14c3975_4 - - zlib=1.2.11=ha838bed_2 + - icc_rt=2019.0.0=h0cc432a_1 + - icu=58.2=ha66f8fd_1 + - intel-openmp=2019.1=144 + - mkl=2019.1=144 + - numpy=1.15.4=py36h19fb1c0_0 + - numpy-base=1.15.4=py36hc3f5095_0 + - pyqt=5.9.2=py36h6538335_2 + - qt=5.9.7=vc14h73c81de_0 + - scikit-learn=0.20.2=py36h343c172_0 + - scipy=1.2.0=py36h29ff71c_0 - pip: - - aiofiles==0.4.0 - chardet==3.0.4 - - cython==0.28.5 - - httptools==0.0.11 - - idna==2.7 - - marisa-trie==0.7.5 - - multidict==4.4.2 - - netifaces==0.10.6 - - python-engineio==2.2.0 - - python-socketio==2.0.0 - - requests==2.19.1 - - sanic==0.8.3 + - idna==2.8 + - joblib==0.13.2 + - marisa-trie==0.7.4 + - mne==0.17.1 + - pylsl==1.13.1 + - pyriemann==0.2.5 + - requests==2.21.0 - socketio-client==0.7.2 - - ujson==1.35 - - urllib3==1.23 - - uvloop==0.11.2 - - websocket-client==0.53.0 - - websockets==5.0.1 -prefix: /home/igor/anaconda3/envs/nlp_service + - urllib3==1.24.1 + - websocket-client==0.54.0 +prefix: C:\Users\karlc\AppData\Local\conda\conda\envs\mindtype