diff --git a/README.md b/README.md index 429a124..965d834 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # SpamBrainz API An API to classify editor account using LodBrok(keras model) in the backend. Also has an option to retrain the model for future enhancement by taking incorrect predictions into consideration as per SpamNinja feedback. -### Steps to run the API: +### Steps to run the API 1) Install all the dependencies needed in virtual environment: @@ -41,4 +41,34 @@ This should run the API in the specified port in debug mode The detailed internal functioning of API is present [here](spambrainz/app/README.md) -The request used, their details and the output are present [here](spambrainz/README.md) \ No newline at end of file +The request used, their details and the output are present [here](spambrainz/README.md) + +### Dockerization for testing + +- Having a docker container of the application would help for further testing with different datasets. + +- To do this, one must have docker installed in your local machine. + +- A Redis Docker container instance is needed to be used by our application. To run a Redis Docker instance, run the following command: + + +``` + $ docker run --name rdb -p 6379:6379 redis + # if already present remove it using + $ docker rm rdb + +``` + +- After Redis is running go to another folder and run the Dockerfile to start the API. + +- After this run the following command in spambrainz directory to build the docker image. + +``` + $ docker build -t spambrainz:latest . +``` + +- Now, you have the build ready with you. Run the build with the following command + +``` + $ sudo docker run -it spambrainz +``` \ No newline at end of file diff --git a/spambrainz/Dockerfile b/spambrainz/Dockerfile new file mode 100644 index 0000000..3119cd5 --- /dev/null +++ b/spambrainz/Dockerfile @@ -0,0 +1,27 @@ +ARG UBUNTU_VERSION=18.04 + +FROM ubuntu:${UBUNTU_VERSION} as base + +ENV LANG C.UTF-8 + +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip + +RUN python3 -m pip --no-cache-dir install --upgrade \ + pip \ + setuptools + +RUN ln -s $(which python3) /usr/local/bin/python + +WORKDIR /app + +COPY . /app + +RUN pip --no-cache-dir install -r requirements_docker.txt + +EXPOSE 5000 + +ENTRYPOINT ["python"] + +CMD ["sb_api.py"] diff --git a/spambrainz/requirements_docker.txt b/spambrainz/requirements_docker.txt new file mode 100644 index 0000000..f99a207 --- /dev/null +++ b/spambrainz/requirements_docker.txt @@ -0,0 +1,58 @@ +absl-py==0.9.0 +aniso8601==8.0.0 +appdirs==1.4.4 +astor==0.8.1 +astunparse==1.6.3 +cachetools==4.1.1 +certifi==2020.6.20 +chardet==3.0.4 +click==7.1.2 +DateTime==4.3 +filelock==3.0.12 +Flask==1.1.2 +Flask-RESTful==0.3.8 +gast==0.3.3 +gevent==20.6.2 +google-auth==1.20.0 +google-auth-oauthlib==0.4.1 +google-pasta==0.2.0 +greenlet==0.4.16 +grpcio==1.30.0 +h5py==2.10.0 +idna==2.10 +importlib-metadata==1.7.0 +itsdangerous==1.1.0 +Jinja2==2.11.2 +Keras==2.3.1 +Keras-Applications==1.0.8 +Keras-Preprocessing==1.1.2 +Markdown==3.2.2 +MarkupSafe==1.1.1 +mbdata==25.0.4 +numpy==1.18.5 +oauthlib==3.1.0 +opt-einsum==3.3.0 +protobuf==3.12.4 +pyasn1==0.4.8 +pyasn1-modules==0.2.8 +pytz==2020.1 +PyYAML==5.3.1 +redis==3.5.3 +requests==2.24.0 +requests-oauthlib==1.3.0 +rsa==4.6 +scipy==1.4.1 +six==1.15.0 +tensorboard==2.3.0 +tensorboard-plugin-wit==1.7.0 +tensorflow==2.3.0 +tensorflow-estimator==2.3.0 +termcolor==1.1.0 +uritools==3.0.0 +urlextract==1.0.0 +urllib3==1.25.10 +Werkzeug==1.0.1 +wrapt==1.12.1 +zipp==3.1.0 +zope.event==4.4 +zope.interface==5.1.0