Model Deployment GL
Model Deployment GL
com
FMEH37ZJ05
Model Deployment
[email protected]
FMEH37ZJ05
All these platforms provide free services to beginners for limited time
period with certain restrictions
[email protected]
FMEH37ZJ05
WHO is a specialized agency of the UN which is concerned with the world population health. Based
upon the various parameters, WHO allocates budget for various areas to conduct various
campaigns/initiatives to improve healthcare. Annual salary is an important variable which is considered
to decide budget to be allocated for an area. We have a data which contains information about 32561
samples and 15 continuous and categorical variables. Extraction of data was done from 1994 Census
dataset. The goal here is to build a binary model to predict whether the salary is >50K or <50K
Data Dictionary
age: age
[email protected]
FMEH37ZJ05
workclass: workclass
fnlwgt: samplting weight
education: highest education
education-no. of years: number of years of education in total
marrital status: marrital status
occupation: occupation
relationship: relationship
race: race
sex: sex
capital gain: income from investment sources other than salary/wages
capital loss: income from investment sources other than salary/wages
working hours: nummber of working hours per week
native-country: native country
salary: salary
Proprietary content. ©Great Learning. AllThisRights
file is meant Reserved. Unauthorized
for personal use by [email protected] only. use or distribution prohibited.
Sharing or publishing the contents in part or full is liable for legal action.
What is FLASK
These files should have an extension as “.html” and these files should be stored
in the folder “templates”
[email protected]
# Import the library files
FMEH37ZJ05
import numpy as np
import pandas as pd
from flask import Flask, request,render_template
import pickle
# Prediction Function
def ValuePredictor(to_predict_list):
to_predict = np.array(to_predict_list).reshape(1, 12)
loaded_model = pickle.load(open("adult_flask.pkl", "rb"))
result = loaded_model.predict(to_predict)
return result[0]
# Main function
if __name__ == "__main__":
app.run(debug=True)
app.config['TEMPLATES_AUTO_RELOAD'] = True
Flask
Templates
Adult.html
result.html
adult_flask.pkl
app.py
[email protected]
FMEH37ZJ05
@ Anconda prompt change the directory to where you have all the files like in our case,
folder is “Flask”. Once you are at the required directory type,
python app.py
This is the URL of the application on your local machine, copy this in the
browser and run the application
Proprietary content. ©Great Learning. AllThisRights
file is meant Reserved. Unauthorized
for personal use by [email protected] only. use or distribution prohibited.
Sharing or publishing the contents in part or full is liable for legal action.
What is Heroku
[email protected]
FMEH37ZJ05
web:gunicorn app:app
Flask==1.1.1
gunicorn ==20.0.4
scikit.learn== 0.22.2
matplotlib == 3.2.1
seaborn==0.9.0
requests==0.11.1
numpy >=1.18.2
pandas >=0.25.1
@ Anconda prompt change the directory to where you have all the files like in our case,
folder is “Flask”. Once you are at the required directory type the following commands in the
same sequence. At the end it will create a link which can be used by anybody.
https://adultsalaryprediction.herokuapp.com/
[email protected]
FMEH37ZJ05
HAPPY LEARNING
Proprietary content. ©Great Learning. AllThisRights
file is meant Reserved. Unauthorized
for personal use by [email protected] only. use or distribution prohibited.
Sharing or publishing the contents in part or full is liable for legal action.