machine-learning-flask-example This project demonstrates how to train and deploy a simple model. I use a model that can predict whether or not a patient has diabetes, based on certain diagnostic measurements included in the dataset from https://github.com/karanmurthy7/machine-learning-flask-example. This project is composed of 5 python files: dataset, model, server, request and flask_app.
diabetes-classification-model.py trains and saves the model to the disk.
server.py contains all the requiered for flask and to manage APIs.
request.py contains the python code to process POST request to server.
flask_app.py contains the python code as modified server in pythonanywhere.com
I the deployed machine learning model into pythonanywhere.com and test it using postman. To deploy the model, run the diabetes-classification-model.py first in local to get the model (log_reg_model.pkl). upload the model along with flask_app.pkl into /home/user/mysite
Try the deployed model with postman. Open postman and insert your pythonanywhere URL and test your model by inputing data as the following example
If you want to try how the model work, you can use my url in the postman and input the following data:
Url: http://rafif.pythonanywhere.com/api
Input example:
{
"pregnancy":6,
"glucoes":148,
"bloodpres":72,
"skin":35,
"insulin":0,
"bmi":33.6,
"diabetesPedi":0.627,
"age":50
}