├── README.md ├── Zomato Dataset ├── Zomato.ipynb ├── Zomato_df.csv ├── app.py ├── model.py ├── static └── css │ └── style.css ├── templates └── index.html └── zomato_docs.pdf /README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Zomato Dataset: -------------------------------------------------------------------------------- 1 | Here is the link to download the DataSet : https://www.kaggle.com/himanshupoddar/zomato-bangalore-restaurants/download 2 | -------------------------------------------------------------------------------- /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 | 13 | @app.route('/predict',methods=['POST']) 14 | def predict(): 15 | ''' 16 | For rendering results on HTML GUI 17 | ''' 18 | features = [int(x) for x in request.form.values()] 19 | final_features = [np.array(features)] 20 | prediction = model.predict(final_features) 21 | 22 | output = round(prediction[0], 1) 23 | 24 | return render_template('index.html', prediction_text='Your Rating is: {}'.format(output)) 25 | 26 | if __name__ == "__main__": 27 | app.run(debug=True) -------------------------------------------------------------------------------- /model.py: -------------------------------------------------------------------------------- 1 | 2 | import pandas as pd 3 | import numpy as np 4 | import sklearn 5 | from sklearn.ensemble import ExtraTreesRegressor 6 | from sklearn.model_selection import train_test_split 7 | 8 | 9 | import warnings 10 | warnings.filterwarnings('ignore') 11 | 12 | df=pd.read_csv('zomato_df.csv') 13 | 14 | df.drop('Unnamed: 0',axis=1,inplace=True) 15 | print(df.head()) 16 | x=df.drop('rate',axis=1) 17 | y=df['rate'] 18 | x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=.3,random_state=10) 19 | 20 | 21 | #Preparing Extra Tree Regression 22 | from sklearn.ensemble import ExtraTreesRegressor 23 | ET_Model=ExtraTreesRegressor(n_estimators = 120) 24 | ET_Model.fit(x_train,y_train) 25 | 26 | 27 | y_predict=ET_Model.predict(x_test) 28 | 29 | 30 | import pickle 31 | # # Saving model to disk 32 | pickle.dump(ET_Model, open('model.pkl','wb')) 33 | model=pickle.load(open('model.pkl','rb')) 34 | print(y_predict) 35 | -------------------------------------------------------------------------------- /static/css/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Open+Sans); 2 | .btn { display: inline-block; *display: inline; *zoom: 1; padding: 4px 10px 4px; margin-bottom: 0; font-size: 13px; line-height: 18px; color: #f70202; text-align: center;text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); vertical-align: middle; background-color: #f5f5f5; background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); background-image: linear-gradient(top, #ffffff, #e6e6e6); background-repeat: repeat-x; filter: progid:dximagetransform.microsoft.gradient(startColorstr=#ffffff, endColorstr=#e6e6e6, GradientType=0); border-color: #e6e6e6 #e6e6e6 #e6e6e6; border-color: rgba(248, 42, 42, 1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); border: 1px solid #e6e6e6; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); cursor: pointer; *margin-left: .3em; } 3 | .btn:hover, .btn:active, .btn.active, .btn.disabled, .btn[disabled] { background-color: #e6e6e6; } 4 | .btn-large { padding: 9px 14px; font-size: 15px; line-height: normal; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; } 5 | .btn:hover { color: #333333; text-decoration: none; background-color: #e6e6e6; background-position: 0 -15px; -webkit-transition: background-position 0.1s linear; -moz-transition: background-position 0.1s linear; -ms-transition: background-position 0.1s linear; -o-transition: background-position 0.1s linear; transition: background-position 0.1s linear; } 6 | .btn-primary, .btn-primary:hover { text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); color: #ffffff; } 7 | .btn-primary.active { color: rgba(255, 255, 255, 0.75); } 8 | .btn-primary { background-color: #CB202D; background-image: -moz-linear-gradient(top, #CB202D, #CB202D); background-image: -ms-linear-gradient(top, #CB202D, #CB202D); background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#CB202D), to(#CB202D)); background-image: -webkit-linear-gradient(top, #CB202D, #CB202D); background-image: -o-linear-gradient(top, #CB202D, #CB202D); background-image: linear-gradient(top, #CB202D, #CB202D); background-repeat: repeat-x; filter: progid:dximagetransform.microsoft.gradient(startColorstr=#CB202D, endColorstr=#CB202D, GradientType=0); border: 1px solid #CB202D; text-shadow: 1px 1px 1px rgba(0,0,0,0.4); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.5); } #change this for the predict button color 9 | .btn-primary:hover, .btn-primary:active, .btn-primary.active, .btn-primary.disabled, .btn-primary[disabled] { filter: none; background-color: #ff5252; } 10 | .btn-block { width: 100%; display:block; } 11 | 12 | * { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; -ms-box-sizing:border-box; -o-box-sizing:border-box; box-sizing:border-box; } 13 | 14 | html { width: 100%; height:100%; overflow:hidden; } 15 | 16 | body { 17 | width: 100%; 18 | height:100%; 19 | font-family: Helvetica, sans-serif; 20 | background: #f82a2a; 21 | color: #fff; 22 | font-size: 18px; 23 | text-align:center; 24 | letter-spacing:1.2px; 25 | background: -moz-radial-gradient(0% 100%, ellipse cover, rgba(104,128,138,.4) 10%,rgba(138,114,76,0) 40%),-moz-linear-gradient(top, rgba(57,173,219,.25) 0%, rgba(42,60,87,.4) 100%), -moz-linear-gradient(-45deg, #670d10 0%, #092756 100%); 26 | background: -webkit-radial-gradient(0% 100%, ellipse cover, rgba(104,128,138,.4) 10%,rgba(138,114,76,0) 40%), -webkit-linear-gradient(top, rgba(57,173,219,.25) 0%,rgba(42,60,87,.4) 100%), -webkit-linear-gradient(-45deg, #670d10 0%,#092756 100%); 27 | background: -o-radial-gradient(0% 100%, ellipse cover, rgba(104,128,138,.4) 10%,rgba(138,114,76,0) 40%), -o-linear-gradient(top, rgba(57,173,219,.25) 0%,rgba(42,60,87,.4) 100%), -o-linear-gradient(-45deg, #670d10 0%,#092756 100%); 28 | background: -ms-radial-gradient(0% 100%, ellipse cover, rgba(104,128,138,.4) 10%,rgba(138,114,76,0) 40%), -ms-linear-gradient(top, rgba(57,173,219,.25) 0%,rgba(42,60,87,.4) 100%), -ms-linear-gradient(-45deg, #670d10 0%,#092756 100%); 29 | background: -webkit-radial-gradient(0% 100%, ellipse cover, rgba(104,128,138,.4) 10%,rgba(138,114,76,0) 40%), linear-gradient(to bottom, rgba(57,173,219,.25) 0%,rgba(42,60,87,.4) 100%), linear-gradient(135deg, #670d10 0%,#092756 100%); 30 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3E1D6D', endColorstr='#092756',GradientType=1 ); 31 | 32 | } 33 | .login { 34 | position: absolute; 35 | top: 40%; 36 | left: 50%; 37 | margin: -150px 0 0 -150px; 38 | width:400px; 39 | height:400px; 40 | } 41 | 42 | .login h1 { color: #fff; text-shadow: 0 0 10px rgba(0,0,0,0.3); letter-spacing:1px; text-align:center; } 43 | 44 | input { 45 | width: 100%; 46 | margin-bottom: 10px; 47 | background: rgba(240, 255, 243, 1); #changed this for the input background 48 | border: none; 49 | outline: none; 50 | padding: 10px; 51 | font-size: 13px; 52 | color: #000000; #change the text color 53 | text-shadow: 1px 1px 1px rgba(0,0,0,0.3); 54 | border: 1px solid rgba(0,0,0,0.3); 55 | border-radius: 4px; 56 | box-shadow: inset 0 -5px 45px rgba(100,100,100,0.2), 0 1px 1px rgba(255,255,255,0.2); 57 | -webkit-transition: box-shadow .5s ease; 58 | -moz-transition: box-shadow .5s ease; 59 | -o-transition: box-shadow .5s ease; 60 | -ms-transition: box-shadow .5s ease; 61 | transition: box-shadow .5s ease; 62 | } 63 | input:focus { box-shadow: inset 0 -5px 45px rgba(100,100,100,0.4), 0 1px 1px rgba(255,255,255,0.2); } -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |