to run scripts and application you will need:
-
setup virtual environment for python (for example using conda) % conda create -n test2 python=3.7 anaconda
-
activate virtual environment % conda activate test2
-
clone repository with python scripts, flask application, DockerFiles and reports with outcomes % git clone https://github.ibm.com/Tomasz-Rozmus/CapstonAssasment
-
change working directory % cd to_dir_with_assigment
-
install required python library $ pip install -r requirements.txt
- to test api (run api server before ) $ python -m unittest tests/api_tests.py
- to test models: $ python -m unittest tests/Model_tests.py
- to test logging capabilites run: $ python -m unittest tests/Logger_tests.py
- or run all tests $ python run_all_test.py
$ python part-2.py
Does the API work as expected? For example, can you get predictions for a specific country as well as for all countries combined?
-
start api by running: $ python app.py
-
open following url in browser:
http://localhost:8080/predict?country=united_kingdom&date=2019-05-05
http://localhost:8080/predict?country=all&date=2019-05-05
helper/fetchlib.py helper/modeltools.py
time-series-notebooks
Capstone Part1.ipynb
Dockerfile
time-series-notebooks
-
build docker image $ docker build -t apiapp .
-
Check that the image is there.
$ docker image ls
-
run docker $ docker run -d -p 8080:8080 apiapp
-
check API open below url in a browser:
http://localhost:8080/predict?country=united_kingdom&date=2019-05-05