Predict the risk given a description of the task
-
For windows, install Docker desktop
-
For Ubuntu, Follow instructions here
Go to the containing folder and run below command in command line
`docker build -t risk-predictor-app .`
Note: Add sudo if you are running Docker with root
`docker run -p 5000:5000 -t risk-predictor-app`
-
Python 3
-
pip3
install using
sudo apt-get install python3-pip
! Recommended to install virtual environment for python. (Might be pre-installed)
-
Installation
sudo pip3 install virtualenv -
Create virtual environment on repo
virtualenv -p python3 ./risk_predictor_venv -
Activate the virtual environment
source risk_predictor_venv/bin/activate
You can install dependencies from the requirements.txt file
`pip -r requirements.txt`
Download Postman from their downloads page for your OS
Note: Postman collection is available in the repository for importing
In the last line, change
app.run(port=5000,host='0.0.0.0', debug=True)
to use the localhost address 127.0.0.1
app.run(port=5000,host='127.0.0.1', debug=True)
`python3 server.py`
When running docker : use host address: 172.17.0.2:5000
when running as standalone python, you can use 127.0.0.1:5000
E.g.: 127.0.0.1:5000\isalive or 172.17.0.2:5000\isalive
| API | type | Description | Expected Request Body | Expected Response |
|---|---|---|---|---|
| /isalive | GET | Checks if the service is available. | {"status": "Live"} |
|
| /predict | POST | Description of task is passed as JSON and the service returns the accident level category from 0 to 4 | {"text":"This is a sample description of task"} |
{"prediction":"Don't worry, there is little risk (Category II)"} |
Access the application at address localhost:5000
