hongaik commited on
Commit
c99a508
1 Parent(s): 8c365f7
.ipynb_checkpoints/secrets-checkpoint.toml ADDED
@@ -0,0 +1 @@
 
 
1
+ public_gsheets_url = "https://docs.google.com/spreadsheets/d/1_LCwPOJYujuRtRE8KWrks76aSye_uu6lY39rsoFGjh4/edit?usp=sharing"
__pycache__/utils.cpython-38.pyc ADDED
Binary file (2.85 kB). View file
 
app.py CHANGED
@@ -10,10 +10,12 @@ import seaborn as sns
10
  from streamlit_folium import st_folium
11
  import matplotlib.pyplot as plt
12
  from datetime import datetime
13
- from datasets import Dataset
 
14
  from utils import *
15
 
16
  ########## Title for the Web App ##########
 
17
  st.title("Property Price Predictor")
18
  st.markdown('_Creator: GOH Hong Aik [[LinkedIn]](https://www.linkedin.com/in/hongaikgoh/)_')
19
  st.markdown("""This app predicts your house price based on a few indicators, and displays amenities within 2 km. Please note the following:
@@ -113,19 +115,6 @@ with st.form("inputs"):
113
  elif input_propertyType == 'HDB':
114
  propertyType_HDB = 1
115
 
116
- # log searches
117
- search_master = pd.read_csv('data/search.csv')
118
- search_df = pd.DataFrame({'datetime': [datetime.now().strftime('%Y-%m-%d %H:%M:%S')],
119
- 'postal': [int(input_postal)],
120
- 'storey': [input_storey],
121
- 'age': [input_age_asof_transaction],
122
- 'floor_area_sqft': [input_floor_area_sqft],
123
- 'property_type': [input_propertyType]
124
- })
125
- search_final = pd.concat([search_master, search_df])
126
- search_dataset = Dataset.from_pandas(search_final)
127
- search_dataset.to_csv('data/search.csv', index=False)
128
-
129
 
130
  latlong_geo['district'] = postal_final.loc[postal_final['2dpostal'] == input_postal[:2], 'district'].item() # all districts are covered in train set
131
  latlong_geo['storey'] = input_storey
@@ -302,5 +291,24 @@ with st.form("inputs"):
302
 
303
  st_folium(m, width=700, height=450)
304
 
305
-
306
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  from streamlit_folium import st_folium
11
  import matplotlib.pyplot as plt
12
  from datetime import datetime
13
+ import gspread
14
+ from oauth2client.service_account import ServiceAccountCredentials
15
  from utils import *
16
 
17
  ########## Title for the Web App ##########
18
+ st.write(client_email)
19
  st.title("Property Price Predictor")
20
  st.markdown('_Creator: GOH Hong Aik [[LinkedIn]](https://www.linkedin.com/in/hongaikgoh/)_')
21
  st.markdown("""This app predicts your house price based on a few indicators, and displays amenities within 2 km. Please note the following:
 
115
  elif input_propertyType == 'HDB':
116
  propertyType_HDB = 1
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  latlong_geo['district'] = postal_final.loc[postal_final['2dpostal'] == input_postal[:2], 'district'].item() # all districts are covered in train set
120
  latlong_geo['storey'] = input_storey
 
291
 
292
  st_folium(m, width=700, height=450)
293
 
294
+ # Log searches
295
+ keydict = {'type': service_account,
296
+ 'project_id': project_id,
297
+ 'private_key_id': private_key_id,
298
+ 'private_key': private_key,
299
+ 'client_email': client_email,
300
+ 'client_id': client_id,
301
+ 'auth_uri': auth_uri,
302
+ 'token_uri': token_uri,
303
+ 'auth_provider_x509_cert_url': auth_provider_x509_cert_url,
304
+ 'client_x509_cert_url': client_x509_cert_url}
305
+
306
+ scope = ['https://www.googleapis.com/auth/spreadsheets',
307
+ "https://www.googleapis.com/auth/drive"]
308
+
309
+ credentials = ServiceAccountCredentials.from_json_keyfile_dict(keydict, scope)
310
+ client = gspread.authorize(credentials)
311
+
312
+ sheet = client.open("PropertyPricePredictor_Sheet").sheet1
313
+ sheet.append_row([datetime.now().strftime('%Y-%m-%d %H:%M:%S'), int(input_postal),input_storey,input_age_asof_transaction,input_floor_area_sqft,input_propertyType])
314
+
data/search.csv DELETED
@@ -1 +0,0 @@
1
- datetime,postal,storey,age,floor_area_sqft,property_type
 
 
requirements.txt CHANGED
@@ -8,4 +8,6 @@ seaborn==0.11.1
8
  streamlit_folium
9
  matplotlib==3.3.4
10
  xgboost==1.5.1
11
- category_encoders==2.5.1.post0
 
 
 
8
  streamlit_folium
9
  matplotlib==3.3.4
10
  xgboost==1.5.1
11
+ category_encoders==2.5.1.post0
12
+ gspread
13
+ oauth2client