├── README.md └── house_rent ├── Procfile ├── model.pkl ├── House_Rent.pdf ├── house_rent.csv ├── request.py ├── requirements.txt ├── app.py ├── house_rent.py └── templates └── index.html /README.md: -------------------------------------------------------------------------------- 1 | # House_Rent -------------------------------------------------------------------------------- /house_rent/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn --bind 0.0.0.0:$PORT app:app 2 | -------------------------------------------------------------------------------- /house_rent/model.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mouneshgouda/House_Rent/main/house_rent/model.pkl -------------------------------------------------------------------------------- /house_rent/House_Rent.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Mouneshgouda/House_Rent/main/house_rent/House_Rent.pdf -------------------------------------------------------------------------------- /house_rent/house_rent.csv: -------------------------------------------------------------------------------- 1 | city,type,bhk,rent 2 | 0,0,1,20000 3 | 0,0,2,30000 4 | 0,1,2,40000 5 | 1,0,3,50000 6 | 1,0,4,60000 7 | 1,1,4,70000 8 | 0,1,5,80000 9 | 1,1,5,90000 10 | -------------------------------------------------------------------------------- /house_rent/request.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from collections.abc import Mapping 3 | 4 | 5 | url = 'http://localhost:5000/predict_api' 6 | r = requests.post(url,json={'city':1, 'type':1, 'bhk':2}) 7 | 8 | print(r.json()) -------------------------------------------------------------------------------- /house_rent/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==2.1.2 2 | gunicorn==19.9.0 3 | itsdangerous==2.0 4 | Jinja2==3.0 5 | MarkupSafe==2.0.0rc2 6 | Werkzeug==2.0 7 | numpy>=1.9.2 8 | scipy>=0.15.1 9 | scikit-learn>=0.18 10 | matplotlib>=1.4.3 11 | pandas>=0.19 12 | 13 | -------------------------------------------------------------------------------- /house_rent/app.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from flask import Flask, request, jsonify, render_template 3 | import pickle 4 | 5 | app = Flask(__name__) 6 | model = pickle.load(open('model.pkl', 'rb')) 7 | 8 | @app.route('/') 9 | def home(): 10 | return render_template('index.html') 11 | 12 | @app.route('/predict',methods=['POST']) 13 | def predict(): 14 | int_features = [int(x) for x in request.form.values()] 15 | final_features = [np.array(int_features)] 16 | prediction = model.predict(final_features) 17 | 18 | output = round(prediction[0], 2) 19 | 20 | return render_template('index.html', prediction_text='House rent approx Rs {}'.format(output)) 21 | 22 | 23 | if __name__ == "__main__": 24 | app.run(debug=True) -------------------------------------------------------------------------------- /house_rent/house_rent.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # In[5]: 5 | 6 | 7 | import numpy as np 8 | import matplotlib.pyplot as plt 9 | import pandas as pd 10 | from sklearn.linear_model import LinearRegression 11 | import pickle 12 | 13 | 14 | # In[2]: 15 | 16 | 17 | dataset = pd.read_csv('house_rent.csv') 18 | 19 | 20 | # In[3]: 21 | 22 | 23 | X = dataset.iloc[:, :3] 24 | y = dataset.iloc[:, -1] 25 | 26 | 27 | # In[6]: 28 | 29 | 30 | regressor = LinearRegression() 31 | 32 | 33 | # In[7]: 34 | 35 | 36 | regressor.fit(X, y) 37 | 38 | 39 | # In[8]: 40 | 41 | 42 | pickle.dump(regressor, open('model.pkl','wb')) 43 | 44 | 45 | # In[9]: 46 | 47 | 48 | model = pickle.load(open('model.pkl','rb')) 49 | 50 | 51 | # In[10]: 52 | 53 | 54 | print(model.predict([[1, 1, 2]])) 55 | 56 | 57 | # In[ ]: 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /house_rent/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 53 | 54 | 55 | 56 |
57 |

58 |
59 |

60 | GitHub 61 | LinkedIn 62 |

63 |
64 |

Prediction of House Rent By Mouneshgouda

65 |
66 |

67 |

68 |

69 | 70 |
71 |
72 | 73 |
74 |
75 | {{ prediction_text }} 76 |
77 | 78 | 79 | 80 | --------------------------------------------------------------------------------