https://www.analyticsvidhya.com/blog/2021/02/ml-model-deployment-with-webhosting-frameworks/
code is in github master branch fork/down load the zip file,consists of model.py,app.py,request.py,templates and csv files. read the folder into Visual Studio Code and run the below commands python model.py we will get an URL - http://localhost:5000 Deploy this @ Heroku explained in detialed in the above blog
deploy simple salary prediction model using Flask and deploy in Heroku
https://sal-prediction-flask.herokuapp.com/
This is a demo project to elaborate how Machine Learn Models are deployed on production using Flask API
model.py - This contains code for our ML model to predict employee salaries observed on training data in 'hiring.csv' file.
app.py - This contains Flask APIs that receives employee details through GUI or API calls, computes the precited value based on our model and returns it.
request.py - This uses requests module to call APIs already defined in app.py and dispaly the returned value.
templates - HTML template to allow user to enter employee detail and displays the predicted employee salary.
I am using Visual studio code to run my project, you can choose your own editor.
Run the below commands by opening cmd prompt in the same folder, consists of all files
python model.py
This would create a serialized version of our model into a file model.pkl
Run app.py using below command to start Flask API
python app.py
Navigate to URL http://localhost:5000
If everything goes well, you should be able to see the predcited salary vaule on the HTML page! alt text
You can also send direct POST requests to FLask API using Python's inbuilt request module Run the beow command to send the request with some pre-popuated values -
python request.py