├── Procfile ├── README.md ├── app.py ├── model └── USA_Housing_Model.pkl ├── requirements.txt └── templates └── index.html /Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn -b :$PORT app:app 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python-Web-App-Flask-ML-Model 2 | 3 | Machine Learning Model Web Based Using Flask Framework 4 | 5 | Dataset Link: Link 6 | 7 | How to make data science Project Article : Link 8 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import flask 2 | import pickle 3 | import pandas as pd 4 | with open(f'model/USA_Housing_Model.pkl', 'rb') as f: 5 | model = pickle.load(f) 6 | app = flask.Flask(__name__, template_folder='templates') 7 | 8 | @app.route('/', methods=['GET', 'POST']) 9 | def main(): 10 | if flask.request.method == 'GET': 11 | return(flask.render_template('index.html')) 12 | if flask.request.method == 'POST': 13 | aai = flask.request.form['aai'] 14 | aah = flask.request.form['aah'] 15 | aan = flask.request.form['aan'] 16 | aanb = flask.request.form['aanb'] 17 | ap = flask.request.form['ap'] 18 | input_variables = pd.DataFrame([[aai,aah,aan,aanb,ap]],columns=['Avg. Area Income','Avg. Area House Age','Avg. Area Number of Rooms','Avg. Area Number of Bedrooms','Area Population'],dtype=float,index=['input']) 19 | prediction = model.predict(input_variables)[0] 20 | return flask.render_template('index.html',original_input={'Avg. Area Income':aai,'Avg. Area House Age':aah,'Avg. Area Number of Rooms':aan,'Avg. Area Number of Bedrooms':aanb,'Area Population':ap},result=prediction) 21 | if __name__ == '__main__': 22 | app.run() 23 | -------------------------------------------------------------------------------- /model/USA_Housing_Model.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RizwanMunawar/Houses-price-prediction-web-app-machine-learning-/8e5f5c3a01e8ab80c10c3c1400e33a33e48d6a2f/model/USA_Housing_Model.pkl -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | click==7.1.2 2 | Flask==2.3.2 3 | Flask-WTF==0.14.3 4 | gunicorn==20.0.4 5 | itsdangerous==1.1.0 6 | Jinja2==2.11.3 7 | joblib==1.2.0 8 | MarkupSafe==1.1.1 9 | numpy==1.22.0 10 | pandas==1.1.0 11 | python-dateutil==2.8.1 12 | python-dotenv==0.14.0 13 | pytz==2020.1 14 | scikit-learn==0.23.2 15 | scipy==1.10.0 16 | six==1.15.0 17 | sklearn==0.0 18 | threadpoolctl==2.1.0 19 | Werkzeug==1.0.1 20 | WTForms==2.3.3 21 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 49 | 50 |
51 |{{ result }}
98 | {% endif %} 99 |