The web app is intended for predicting house prices in Boston, United States. Model was trained on the predefined and cleaned dataset and can predict price by given parameters. Trained model is saved to model.pkl file.
First, clone the repository and create a virtualenv. Then install the requirements:
- Run
pip install -r requirements.txt
to install project requirements - Type
flask run
to start the app
The API endpoint is a Flask app hosted on heroku https://boston-predictions.herokuapp.com which you can access with any REST API client, such as Postman. There is only one main route:
- /predict - takes POST requests, predicts price by parameters provided.
{"inputs": [[6.28807, 0.0, 18.1, 0.0, 0.74, 6.341, 96.4, 2.072, 24.0, 666.0, 20.2, 318.01, 17.79],
[14.4208, 0.0, 18.1, 0.0, 0.74, 6.461, 93.3, 2.0026, 24.0, 666.0, 20.2, 27.49, 18.05]]}
You can also use requests module and use the API in a Jupyter notebook like this:
import json
import requests
predict_url = 'https://boston-predictions.herokuapp.com/predict'
json_input = {"inputs": [[14.4208, 0.0, 18.1, 0.0, 0.74, 6.461,
93.3, 2.0026, 24.0, 666.0, 20.2, 27.49,
18.05]]}
response = requests.post(predict_url, data=json.dumps(json_input))
print (f"response: {json.loads(response.content)}")
Project is: in progress
This project was based on Turing College learning on deploying machine learning models.
Created by @fortune_uwha - feel free to contact me!
Feel free to submit an issue with your ideas or comments. I will be happy to see your way of scaffolding Flask applications.
This project is open source and available under the terms of the MIT license.