MikeMai commited on
Commit
70dd0de
·
verified ·
1 Parent(s): 624bbb7

First Commit

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ Resale[[:space:]]Flat[[:space:]]Price.csv filter=lfs diff=lfs merge=lfs -text
NN_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de214846be63b8501d636c921649bc2407d50e40d112acbd9e72cc2f0eef564f
3
+ size 531272
NN_scaler.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa213f00aa5bc69036412219154864191cb95b83578de0f375f2e132b48a02b5
3
+ size 1087
Resale Flat Price.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:074c329ef187737178d36e149023db28f226b05192332ebcf20b04022bdd0838
3
+ size 18807467
app.py ADDED
@@ -0,0 +1,865 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pandas as pd
3
+ import joblib
4
+ from tensorflow.keras.models import load_model
5
+ import matplotlib.pyplot as plt
6
+
7
+ # Load the trained model
8
+ model = load_model('NN_model.h5')
9
+
10
+ # Load category mappings
11
+ town_categories = joblib.load('town_categories.pkl')
12
+ street_name_categories = joblib.load('street_name_categories.pkl')
13
+
14
+ # Load the scaler used during training
15
+ scaler = joblib.load('NN_scaler.pkl')
16
+
17
+ # Load the data
18
+ town_data = pd.read_csv('Resale Flat Price.csv')
19
+
20
+ from openai import OpenAI
21
+ from dotenv import load_dotenv
22
+ load_dotenv()
23
+ client = OpenAI()
24
+
25
+ def get_advice(monthly_avg, year, predicted_price, town, street_name, floor, flat_type, flat_model, floor_area_sqm, lease_commence_date):
26
+ """
27
+ Calls OpenAI API to get advice on whether the property is a good buy.
28
+
29
+ Parameters:
30
+ - monthly_avg (float): The average resale price of all house types sold in the area from 2017 to 2024.
31
+ - year (int): The current year when the property is being evaluated.
32
+ - predicted_price (float): The predicted resale price of the property.
33
+ - town (str): The town where the property is located.
34
+ - street_name (str): The street name of the property location.
35
+ - floor (int): The floor level of the property.
36
+ - flat_type (str): The type of flat (e.g., '2 ROOM', '3 ROOM').
37
+ - flat_model (str): The model of the flat (e.g., 'Improved', 'Model A').
38
+ - floor_area_sqm (float): The floor area of the flat in square meters.
39
+ - lease_commence_date (int): The year the lease of the property commenced.
40
+
41
+ Returns:
42
+ - str: Advice on whether the property is a good buy, based on resale trends and investment potential.
43
+ """
44
+
45
+ # Calculate remaining lease
46
+ remaining_years = 99 - (year - lease_commence_date)
47
+
48
+ # Prepare a prompt with the property details
49
+ prompt = f"""I have a property with the following details:
50
+ - Predicted resale price: S${predicted_price} at {year}
51
+ - Monthly Average of all types of houses sold in the same area from 2017 to 2024: {monthly_avg}
52
+ (Note that the difference in predicted price and monthly average might be because of the nature of the flat type/size of house)
53
+ - Town: {town}
54
+ - Street Name: {street_name}
55
+ - Floor: {floor}
56
+ - Flat Type: {flat_type}
57
+ - Flat Model: {flat_model}
58
+ - Floor Area (sqm): {floor_area_sqm}
59
+ - Remaining Lease: {remaining_years}
60
+
61
+ Based on these details, please advise whether this is a good buy in Singapore, considering resale trends and investment potential in point form. Talk about monthly average trends.
62
+ Do not ask me to check for anything.
63
+ Give a concise response.
64
+ """
65
+
66
+ # Make the OpenAI API call
67
+ response = client.chat.completions.create(
68
+ model="gpt-4o-mini",
69
+ temperature=0.7,
70
+ messages=[
71
+ {"role": "system", "content": "You are a helpful real estate advisor"},
72
+ {"role": "user", "content": prompt}
73
+ ]
74
+ )
75
+
76
+ # Extract and return the response text
77
+ advice = response.choices[0].message.content
78
+ advice = advice.replace("*", "").replace("#", "")
79
+ return advice
80
+
81
+ def NN_predict(year, month, town, street_name, floor, flat_type, flat_model, floor_area_sqm, lease_commence_date):
82
+
83
+ """
84
+ Predicts the resale price of a property using a neural network model.
85
+
86
+ Parameters:
87
+ - year (int): The current year when the property is being evaluated.
88
+ - month (int): The current month when the property is being evaluated.
89
+ - town (str): The town where the property is located.
90
+ - street_name (str): The street name of the property location.
91
+ - floor (int): The floor level of the property.
92
+ - flat_type (str): The type of flat (e.g., '2 ROOM', '3 ROOM').
93
+ - flat_model (str): The model of the flat (e.g., 'Improved', 'Model A').
94
+ - floor_area_sqm (float): The floor area of the flat in square meters.
95
+ - lease_commence_date (int): The year the lease of the property commenced.
96
+
97
+ Returns:
98
+ - str: The predicted resale price in Singapore dollars, formatted as a string.
99
+ """
100
+
101
+ # Calculate remaining lease
102
+ remaining_years = 99 - (year - lease_commence_date)
103
+
104
+ # Encode 'town' and 'street_name'
105
+ if town in town_categories and street_name in street_name_categories:
106
+ town_code = town_categories.index(town)
107
+ street_name_code = street_name_categories.index(street_name)
108
+ else:
109
+ return "Error: Town or Street Name not found in mappings."
110
+
111
+ # Prepare inputs
112
+ town_embedding_vector = np.array([[town_code]], dtype=np.int32)
113
+ street_name_embedding_vector = np.array([[street_name_code]], dtype=np.int32)
114
+
115
+ # Map flat_type and flat_model to encoded values
116
+ flat_type_mapping = {
117
+ '1 ROOM': 1,
118
+ '2 ROOM': 2,
119
+ '3 ROOM': 3,
120
+ '4 ROOM': 4,
121
+ '5 ROOM': 5,
122
+ 'EXECUTIVE': 6,
123
+ 'MULTI-GENERATION': 7
124
+ }
125
+ flat_model_mapping = {
126
+ '2-room': 1,
127
+ 'Improved': 2,
128
+ 'Simplified': 3,
129
+ 'Standard': 4,
130
+ 'Apartment': 5,
131
+ 'Type S1': 6,
132
+ 'Type S2': 7,
133
+ 'Model A': 8,
134
+ 'Model A2': 9,
135
+ 'New Generation': 10,
136
+ 'Adjoined flat': 11,
137
+ 'Improved-Maisonette': 12,
138
+ 'Maisonette': 13,
139
+ 'Model A-Maisonette': 14,
140
+ 'Multi Generation': 15,
141
+ 'Premium Apartment': 16,
142
+ 'Premium Maisonette': 17,
143
+ 'DBSS': 18,
144
+ 'Terrace': 19,
145
+ 'Premium Apartment Loft': 20,
146
+ '3Gen': 21
147
+ }
148
+
149
+ encoded_flat_type = flat_type_mapping[flat_type]
150
+ encoded_flat_model = flat_model_mapping[flat_model]
151
+
152
+ # Convert inputs to correct types
153
+ year = int(year)
154
+ month = int(month)
155
+ floor = int(floor)
156
+ floor_area_sqm = float(floor_area_sqm)
157
+ remaining_years = int(remaining_years)
158
+
159
+ # Scale continuous features using the same scaler as during training
160
+ numeric_features = np.array([[year, month, floor, floor_area_sqm, remaining_years]], dtype=np.float32)
161
+ scaled_numeric_features = scaler.transform(numeric_features)
162
+
163
+ # Prepare the numeric input by concatenating scaled continuous and categorical features
164
+ numeric_input = np.concatenate([scaled_numeric_features, [[encoded_flat_type, encoded_flat_model]]], axis=1).astype(np.float32) # Shape (1, 7)
165
+
166
+ # Pass the three separate inputs as required by the model
167
+ prediction = model.predict([town_embedding_vector, street_name_embedding_vector, numeric_input])
168
+
169
+ # Format prediction output
170
+ predicted_price = prediction[0][0]
171
+ output = f"S${predicted_price:,.2f}"
172
+
173
+ return output
174
+
175
+ def plot(town_data, street_name, forecast_years=1):
176
+ """
177
+ Generates a time series plot for the resale price trend over time for a specified street name.
178
+
179
+ Parameters:
180
+ - town_data (DataFrame): The DataFrame containing the data with columns 'street_name', 'time', and 'resale_price'.
181
+ - street_name (str): The street name to filter the data by.
182
+
183
+ Returns:
184
+ - tuple: A tuple containing the formatted prediction as a string and the file path to the saved plot image.
185
+ """
186
+
187
+ # Filter data for the specified street name
188
+ filtered_town_data = town_data[town_data['street_name'] == street_name]
189
+
190
+ # Check if the filtered dataset is empty
191
+ if filtered_town_data.empty:
192
+ raise ValueError("No flat type in the area")
193
+
194
+ # Extract sale year and month from the 'month' column
195
+ filtered_town_data['sale_year'] = filtered_town_data['month'].apply(lambda x: int(x.split('-')[0])) # Get year from 'month'
196
+ filtered_town_data['sale_month'] = filtered_town_data['month'].apply(lambda x: int(x.split('-')[1])) # Get month from 'month'
197
+
198
+ # Convert the 'month' column to a numerical representation
199
+ filtered_town_data['time'] = filtered_town_data['sale_year'] + (filtered_town_data['sale_month'] - 1) / 12
200
+
201
+ # Sort data by 'time'
202
+ filtered_data = filtered_town_data.sort_values(by='time')
203
+
204
+ # Group by month and calculate the average resale price
205
+ monthly_avg = filtered_data.groupby('time')['resale_price'].mean().reset_index()
206
+ monthly_avg = monthly_avg[:-1]
207
+
208
+ # Plot the average monthly resale price trend
209
+ plt.figure(figsize=(10, 6))
210
+ plt.plot(monthly_avg['time'], monthly_avg['resale_price'], color='blue', label='Average Monthly Resale Price')
211
+ plt.xlabel('Time (Year)')
212
+ plt.ylabel('Average Resale Price')
213
+ plt.title(f'Average Monthly Resale Price Trend Over Time for {street_name}')
214
+ plt.legend()
215
+
216
+ # Save the plot and close it
217
+ plot_path = "resale_price_trend.png"
218
+ plt.savefig(plot_path)
219
+ plt.close()
220
+
221
+ # Format prediction and return results
222
+ return plot_path, monthly_avg
223
+
224
+
225
+ def predict_price(year, month, town, street_name, floor, flat_type, flat_model, floor_area_sqm, lease_commence_date):
226
+
227
+ predicted_price = NN_predict(year, month, town, street_name, floor, flat_type, flat_model, floor_area_sqm, lease_commence_date)
228
+ plot_path, monthly_avg = plot(town_data, street_name)
229
+ recommendation = get_advice(monthly_avg, year, predicted_price, town, street_name, floor, flat_type, flat_model, floor_area_sqm, lease_commence_date)
230
+
231
+ return predicted_price, plot_path, recommendation
232
+
233
+ # # Example usage
234
+ # predicted = predict_price(
235
+ # year=2024,
236
+ # month=10,
237
+ # town='ANG MO KIO',
238
+ # street_name='ANG MO KIO AVE 10',
239
+ # floor=10,
240
+ # flat_type='2 ROOM',
241
+ # flat_model='Improved',
242
+ # floor_area_sqm=44,
243
+ # lease_commence_date=1979
244
+ # )
245
+
246
+ # print(predicted)
247
+
248
+ # Gradio
249
+ import gradio as gr
250
+
251
+ interface = gr.Interface(
252
+ fn=predict_price,
253
+ title="NeuralNest",
254
+ inputs=[
255
+ gr.components.Number(label="Year", value = 2024),
256
+ gr.components.Number(label="Month", value = 11),
257
+ gr.components.Dropdown(choices=['ANG MO KIO',
258
+ 'BEDOK',
259
+ 'BISHAN',
260
+ 'BUKIT BATOK',
261
+ 'BUKIT MERAH',
262
+ 'BUKIT PANJANG',
263
+ 'BUKIT TIMAH',
264
+ 'CENTRAL AREA',
265
+ 'CHOA CHU KANG',
266
+ 'CLEMENTI',
267
+ 'GEYLANG',
268
+ 'HOUGANG',
269
+ 'JURONG EAST',
270
+ 'JURONG WEST',
271
+ 'KALLANG/WHAMPOA',
272
+ 'MARINE PARADE',
273
+ 'PASIR RIS',
274
+ 'PUNGGOL',
275
+ 'QUEENSTOWN',
276
+ 'SEMBAWANG',
277
+ 'SENGKANG',
278
+ 'SERANGOON',
279
+ 'TAMPINES',
280
+ 'TOA PAYOH',
281
+ 'WOODLANDS',
282
+ 'YISHUN'], value = 'ANG MO KIO', label="Town"),
283
+ gr.components.Dropdown(choices=['ANG MO KIO AVE 10',
284
+ 'ANG MO KIO AVE 4',
285
+ 'ANG MO KIO AVE 5',
286
+ 'ANG MO KIO AVE 1',
287
+ 'ANG MO KIO AVE 3',
288
+ 'ANG MO KIO AVE 9',
289
+ 'ANG MO KIO AVE 8',
290
+ 'ANG MO KIO AVE 6',
291
+ 'ANG MO KIO ST 52',
292
+ 'BEDOK NTH AVE 4',
293
+ 'BEDOK NTH AVE 1',
294
+ 'BEDOK NTH RD',
295
+ 'BEDOK STH AVE 1',
296
+ 'BEDOK RESERVOIR RD',
297
+ 'CHAI CHEE ST',
298
+ 'BEDOK NTH ST 3',
299
+ 'BEDOK STH RD',
300
+ 'CHAI CHEE AVE',
301
+ 'NEW UPP CHANGI RD',
302
+ 'CHAI CHEE DR',
303
+ 'BEDOK STH AVE 2',
304
+ 'BEDOK NTH AVE 3',
305
+ 'BEDOK RESERVOIR VIEW',
306
+ 'CHAI CHEE RD',
307
+ 'LENGKONG TIGA',
308
+ 'BEDOK CTRL',
309
+ 'JLN DAMAI',
310
+ 'BEDOK NTH AVE 2',
311
+ 'BEDOK STH AVE 3',
312
+ 'SIN MING RD',
313
+ 'SIN MING AVE',
314
+ 'BISHAN ST 12',
315
+ 'BISHAN ST 13',
316
+ 'BISHAN ST 22',
317
+ 'BISHAN ST 24',
318
+ 'BISHAN ST 23',
319
+ 'BRIGHT HILL DR',
320
+ 'SHUNFU RD',
321
+ 'BT BATOK ST 34',
322
+ 'BT BATOK ST 51',
323
+ 'BT BATOK ST 11',
324
+ 'BT BATOK ST 52',
325
+ 'BT BATOK ST 21',
326
+ 'BT BATOK EAST AVE 5',
327
+ 'BT BATOK WEST AVE 6',
328
+ 'BT BATOK CTRL',
329
+ 'BT BATOK WEST AVE 8',
330
+ 'BT BATOK EAST AVE 4',
331
+ 'BT BATOK ST 31',
332
+ 'BT BATOK ST 25',
333
+ 'BT BATOK EAST AVE 3',
334
+ 'BT BATOK WEST AVE 5',
335
+ 'BT BATOK ST 24',
336
+ 'JLN BT HO SWEE',
337
+ 'TELOK BLANGAH DR',
338
+ 'BEO CRES',
339
+ 'TELOK BLANGAH CRES',
340
+ 'TAMAN HO SWEE',
341
+ 'TELOK BLANGAH RISE',
342
+ 'TELOK BLANGAH WAY',
343
+ 'JLN BT MERAH',
344
+ 'JLN KLINIK',
345
+ 'TELOK BLANGAH HTS',
346
+ 'BT MERAH VIEW',
347
+ 'INDUS RD',
348
+ 'BT MERAH LANE 1',
349
+ 'TELOK BLANGAH ST 31',
350
+ 'MOH GUAN TER',
351
+ 'HAVELOCK RD',
352
+ 'HENDERSON CRES',
353
+ 'BT PURMEI RD',
354
+ 'KIM TIAN RD',
355
+ 'DEPOT RD',
356
+ 'JLN RUMAH TINGGI',
357
+ 'DELTA AVE',
358
+ 'JLN MEMBINA',
359
+ 'REDHILL RD',
360
+ 'LENGKOK BAHRU',
361
+ 'ZION RD',
362
+ 'PETIR RD',
363
+ 'PENDING RD',
364
+ 'BANGKIT RD',
365
+ 'SEGAR RD',
366
+ 'JELAPANG RD',
367
+ 'SENJA RD',
368
+ 'FAJAR RD',
369
+ 'BT PANJANG RING RD',
370
+ 'SENJA LINK',
371
+ 'LOMPANG RD',
372
+ 'GANGSA RD',
373
+ 'TOH YI DR',
374
+ 'FARRER RD',
375
+ 'JLN KUKOH',
376
+ 'ROWELL RD',
377
+ 'WATERLOO ST',
378
+ 'NEW MKT RD',
379
+ 'TG PAGAR PLAZA',
380
+ 'QUEEN ST',
381
+ 'BAIN ST',
382
+ 'CANTONMENT RD',
383
+ 'TECK WHYE LANE',
384
+ 'CHOA CHU KANG AVE 4',
385
+ 'CHOA CHU KANG AVE 3',
386
+ 'CHOA CHU KANG CRES',
387
+ 'CHOA CHU KANG ST 54',
388
+ 'CHOA CHU KANG CTRL',
389
+ 'JLN TECK WHYE',
390
+ 'CHOA CHU KANG ST 62',
391
+ 'CHOA CHU KANG NTH 6',
392
+ 'CHOA CHU KANG DR',
393
+ 'CHOA CHU KANG NTH 5',
394
+ 'CHOA CHU KANG ST 52',
395
+ 'CHOA CHU KANG AVE 2',
396
+ 'CLEMENTI WEST ST 2',
397
+ 'WEST COAST RD',
398
+ 'CLEMENTI WEST ST 1',
399
+ 'CLEMENTI AVE 4',
400
+ 'CLEMENTI AVE 5',
401
+ 'CLEMENTI ST 11',
402
+ 'CLEMENTI AVE 2',
403
+ 'CLEMENTI AVE 3',
404
+ 'CLEMENTI AVE 1',
405
+ "C'WEALTH AVE WEST",
406
+ 'CIRCUIT RD',
407
+ 'BALAM RD',
408
+ 'MACPHERSON LANE',
409
+ 'EUNOS CRES',
410
+ 'UBI AVE 1',
411
+ 'HAIG RD',
412
+ 'OLD AIRPORT RD',
413
+ 'GEYLANG EAST AVE 1',
414
+ 'SIMS DR',
415
+ 'PIPIT RD',
416
+ 'GEYLANG EAST CTRL',
417
+ 'EUNOS RD 5',
418
+ 'CASSIA CRES',
419
+ 'BUANGKOK CRES',
420
+ 'HOUGANG AVE 3',
421
+ 'HOUGANG AVE 8',
422
+ 'HOUGANG AVE 1',
423
+ 'HOUGANG AVE 5',
424
+ 'HOUGANG ST 61',
425
+ 'HOUGANG ST 11',
426
+ 'HOUGANG AVE 7',
427
+ 'HOUGANG AVE 4',
428
+ 'HOUGANG AVE 2',
429
+ 'LOR AH SOO',
430
+ 'HOUGANG ST 92',
431
+ 'HOUGANG ST 52',
432
+ 'HOUGANG AVE 10',
433
+ 'HOUGANG ST 51',
434
+ 'UPP SERANGOON RD',
435
+ 'HOUGANG CTRL',
436
+ 'HOUGANG ST 91',
437
+ 'BUANGKOK LINK',
438
+ 'HOUGANG ST 31',
439
+ 'PANDAN GDNS',
440
+ 'TEBAN GDNS RD',
441
+ 'JURONG EAST ST 24',
442
+ 'JURONG EAST ST 21',
443
+ 'JURONG EAST AVE 1',
444
+ 'JURONG EAST ST 13',
445
+ 'JURONG EAST ST 32',
446
+ 'TOH GUAN RD',
447
+ 'JURONG WEST ST 93',
448
+ 'BOON LAY AVE',
449
+ 'HO CHING RD',
450
+ 'BOON LAY DR',
451
+ 'TAO CHING RD',
452
+ 'JURONG WEST ST 91',
453
+ 'JURONG WEST ST 42',
454
+ 'JURONG WEST ST 92',
455
+ 'BOON LAY PL',
456
+ 'JURONG WEST ST 52',
457
+ 'TAH CHING RD',
458
+ 'JURONG WEST ST 81',
459
+ 'YUNG SHENG RD',
460
+ 'JURONG WEST ST 25',
461
+ 'JURONG WEST ST 73',
462
+ 'JURONG WEST ST 72',
463
+ 'JURONG WEST AVE 3',
464
+ 'JURONG WEST AVE 5',
465
+ 'YUNG HO RD',
466
+ 'JURONG WEST ST 74',
467
+ 'JURONG WEST AVE 1',
468
+ 'JURONG WEST ST 71',
469
+ 'JURONG WEST ST 61',
470
+ 'JURONG WEST ST 65',
471
+ 'JURONG WEST CTRL 1',
472
+ 'JURONG WEST ST 64',
473
+ 'JURONG WEST ST 62',
474
+ 'JURONG WEST ST 41',
475
+ 'JURONG WEST ST 24',
476
+ 'JLN BATU',
477
+ 'JLN BAHAGIA',
478
+ 'LOR LIMAU',
479
+ "ST. GEORGE'S RD",
480
+ 'KALLANG BAHRU',
481
+ 'DORSET RD',
482
+ 'GEYLANG BAHRU',
483
+ 'BENDEMEER RD',
484
+ 'WHAMPOA DR',
485
+ 'UPP BOON KENG RD',
486
+ 'RACE COURSE RD',
487
+ 'OWEN RD',
488
+ 'NTH BRIDGE RD',
489
+ 'TOWNER RD',
490
+ 'FARRER PK RD',
491
+ 'MCNAIR RD',
492
+ 'JLN TENTERAM',
493
+ 'BOON KENG RD',
494
+ 'JLN RAJAH',
495
+ 'MARINE DR',
496
+ 'MARINE CRES',
497
+ 'MARINE TER',
498
+ 'CHANGI VILLAGE RD',
499
+ 'PASIR RIS ST 71',
500
+ 'PASIR RIS ST 11',
501
+ 'PASIR RIS DR 3',
502
+ 'PASIR RIS DR 6',
503
+ 'PASIR RIS ST 21',
504
+ 'PASIR RIS DR 4',
505
+ 'PASIR RIS ST 53',
506
+ 'PASIR RIS DR 10',
507
+ 'PASIR RIS ST 52',
508
+ 'PASIR RIS ST 12',
509
+ 'PASIR RIS ST 51',
510
+ 'PASIR RIS ST 72',
511
+ 'PASIR RIS DR 1',
512
+ 'PUNGGOL FIELD',
513
+ 'EDGEDALE PLAINS',
514
+ 'PUNGGOL FIELD WALK',
515
+ 'EDGEFIELD PLAINS',
516
+ 'PUNGGOL RD',
517
+ 'PUNGGOL EAST',
518
+ 'PUNGGOL DR',
519
+ 'PUNGGOL CTRL',
520
+ 'PUNGGOL PL',
521
+ "C'WEALTH CL",
522
+ 'STIRLING RD',
523
+ 'MEI LING ST',
524
+ "C'WEALTH CRES",
525
+ "C'WEALTH DR",
526
+ 'GHIM MOH RD',
527
+ 'DOVER RD',
528
+ 'HOLLAND AVE',
529
+ 'STRATHMORE AVE',
530
+ 'HOLLAND DR',
531
+ 'GHIM MOH LINK',
532
+ 'CLARENCE LANE',
533
+ 'DOVER CRES',
534
+ 'SEMBAWANG DR',
535
+ 'SEMBAWANG CL',
536
+ 'MONTREAL DR',
537
+ 'ADMIRALTY LINK',
538
+ 'ADMIRALTY DR',
539
+ 'SEMBAWANG CRES',
540
+ 'CANBERRA RD',
541
+ 'FERNVALE RD',
542
+ 'COMPASSVALE LANE',
543
+ 'ANCHORVALE RD',
544
+ 'RIVERVALE DR',
545
+ 'RIVERVALE CRES',
546
+ 'SENGKANG EAST WAY',
547
+ 'RIVERVALE ST',
548
+ 'RIVERVALE WALK',
549
+ 'FERNVALE LANE',
550
+ 'ANCHORVALE LINK',
551
+ 'COMPASSVALE RD',
552
+ 'COMPASSVALE CRES',
553
+ 'JLN KAYU',
554
+ 'COMPASSVALE WALK',
555
+ 'COMPASSVALE DR',
556
+ 'COMPASSVALE LINK',
557
+ 'COMPASSVALE BOW',
558
+ 'SENGKANG CTRL',
559
+ 'ANCHORVALE LANE',
560
+ 'ANCHORVALE DR',
561
+ 'COMPASSVALE ST',
562
+ 'SERANGOON AVE 4',
563
+ 'LOR LEW LIAN',
564
+ 'SERANGOON AVE 2',
565
+ 'SERANGOON NTH AVE 1',
566
+ 'SERANGOON AVE 1',
567
+ 'SERANGOON CTRL',
568
+ 'SERANGOON NTH AVE 4',
569
+ 'TAMPINES ST 22',
570
+ 'TAMPINES ST 41',
571
+ 'TAMPINES AVE 4',
572
+ 'TAMPINES ST 44',
573
+ 'TAMPINES ST 81',
574
+ 'TAMPINES ST 11',
575
+ 'TAMPINES ST 23',
576
+ 'TAMPINES ST 91',
577
+ 'TAMPINES ST 21',
578
+ 'TAMPINES ST 83',
579
+ 'TAMPINES ST 42',
580
+ 'TAMPINES ST 71',
581
+ 'TAMPINES ST 45',
582
+ 'TAMPINES ST 34',
583
+ 'TAMPINES ST 82',
584
+ 'TAMPINES AVE 9',
585
+ 'SIMEI ST 1',
586
+ 'SIMEI ST 5',
587
+ 'TAMPINES ST 72',
588
+ 'TAMPINES ST 84',
589
+ 'SIMEI ST 2',
590
+ 'TAMPINES CTRL 7',
591
+ 'TAMPINES ST 33',
592
+ 'TAMPINES ST 32',
593
+ 'TAMPINES AVE 5',
594
+ 'LOR 5 TOA PAYOH',
595
+ 'LOR 7 TOA PAYOH',
596
+ 'LOR 4 TOA PAYOH',
597
+ 'LOR 1 TOA PAYOH',
598
+ 'TOA PAYOH EAST',
599
+ 'POTONG PASIR AVE 1',
600
+ 'TOA PAYOH NTH',
601
+ 'LOR 8 TOA PAYOH',
602
+ 'LOR 3 TOA PAYOH',
603
+ 'POTONG PASIR AVE 3',
604
+ 'JOO SENG RD',
605
+ 'LOR 2 TOA PAYOH',
606
+ 'TOA PAYOH CTRL',
607
+ 'MARSILING DR',
608
+ 'WOODLANDS ST 13',
609
+ 'WOODLANDS DR 52',
610
+ 'WOODLANDS ST 41',
611
+ 'MARSILING CRES',
612
+ 'WOODLANDS ST 83',
613
+ 'WOODLANDS CIRCLE',
614
+ 'WOODLANDS DR 40',
615
+ 'WOODLANDS ST 31',
616
+ 'WOODLANDS DR 16',
617
+ 'WOODLANDS ST 81',
618
+ 'WOODLANDS RING RD',
619
+ 'WOODLANDS DR 53',
620
+ 'WOODLANDS DR 62',
621
+ 'WOODLANDS DR 70',
622
+ 'WOODLANDS DR 42',
623
+ 'WOODLANDS DR 50',
624
+ 'WOODLANDS AVE 6',
625
+ 'WOODLANDS DR 14',
626
+ 'WOODLANDS AVE 1',
627
+ 'WOODLANDS AVE 5',
628
+ 'MARSILING RISE',
629
+ 'WOODLANDS CRES',
630
+ 'WOODLANDS DR 73',
631
+ 'WOODLANDS DR 44',
632
+ 'YISHUN RING RD',
633
+ 'YISHUN AVE 3',
634
+ 'YISHUN ST 11',
635
+ 'YISHUN AVE 4',
636
+ 'YISHUN ST 22',
637
+ 'YISHUN ST 71',
638
+ 'YISHUN AVE 5',
639
+ 'YISHUN ST 21',
640
+ 'YISHUN ST 41',
641
+ 'YISHUN ST 61',
642
+ 'YISHUN AVE 6',
643
+ 'YISHUN AVE 11',
644
+ 'YISHUN CTRL',
645
+ 'YISHUN ST 81',
646
+ 'YISHUN ST 72',
647
+ 'YISHUN AVE 2',
648
+ 'ANG MO KIO ST 32',
649
+ 'ANG MO KIO ST 31',
650
+ 'BEDOK NTH ST 2',
651
+ 'BEDOK NTH ST 1',
652
+ 'JLN TENAGA',
653
+ 'BEDOK NTH ST 4',
654
+ 'BT BATOK WEST AVE 4',
655
+ 'CANTONMENT CL',
656
+ 'BOON TIONG RD',
657
+ 'SPOTTISWOODE PK RD',
658
+ 'REDHILL CL',
659
+ 'KIM TIAN PL',
660
+ 'CASHEW RD',
661
+ "QUEEN'S RD",
662
+ 'CHANDER RD',
663
+ 'KELANTAN RD',
664
+ 'SAGO LANE',
665
+ 'UPP CROSS ST',
666
+ 'CHIN SWEE RD',
667
+ 'SMITH ST',
668
+ 'TECK WHYE AVE',
669
+ 'CHOA CHU KANG ST 51',
670
+ 'CHOA CHU KANG AVE 5',
671
+ 'CHOA CHU KANG AVE 1',
672
+ 'WEST COAST DR',
673
+ 'PAYA LEBAR WAY',
674
+ 'ALJUNIED CRES',
675
+ 'JOO CHIAT RD',
676
+ 'PINE CL',
677
+ 'HOUGANG ST 22',
678
+ 'HOUGANG AVE 9',
679
+ 'HOUGANG AVE 6',
680
+ 'HOUGANG ST 21',
681
+ 'JURONG WEST ST 75',
682
+ 'KANG CHING RD',
683
+ 'KG KAYU RD',
684
+ 'CRAWFORD LANE',
685
+ 'WHAMPOA WEST',
686
+ 'BEACH RD',
687
+ 'CAMBRIDGE RD',
688
+ "ST. GEORGE'S LANE",
689
+ 'JELLICOE RD',
690
+ 'ELIAS RD',
691
+ 'HOLLAND CL',
692
+ 'TANGLIN HALT RD',
693
+ "C'WEALTH AVE",
694
+ 'WELLINGTON CIRCLE',
695
+ 'CANBERRA LINK',
696
+ 'SENGKANG WEST AVE',
697
+ 'SENGKANG EAST RD',
698
+ 'SERANGOON CTRL DR',
699
+ 'SERANGOON AVE 3',
700
+ 'SERANGOON NTH AVE 3',
701
+ 'TAMPINES AVE 8',
702
+ 'TAMPINES ST 24',
703
+ 'TAMPINES ST 12',
704
+ 'SIMEI LANE',
705
+ 'SIMEI ST 4',
706
+ 'LOR 6 TOA PAYOH',
707
+ 'KIM KEAT LINK',
708
+ 'MARSILING LANE',
709
+ 'WOODLANDS ST 82',
710
+ 'WOODLANDS DR 60',
711
+ 'WOODLANDS AVE 3',
712
+ 'WOODLANDS DR 75',
713
+ 'WOODLANDS AVE 4',
714
+ 'WOODLANDS ST 32',
715
+ 'YISHUN AVE 7',
716
+ 'ANG MO KIO ST 11',
717
+ 'BISHAN ST 11',
718
+ 'BT BATOK WEST AVE 2',
719
+ 'BT BATOK ST 32',
720
+ 'BT BATOK ST 33',
721
+ 'BT BATOK ST 22',
722
+ 'BT BATOK WEST AVE 7',
723
+ 'HOY FATT RD',
724
+ 'SILAT AVE',
725
+ 'EVERTON PK',
726
+ 'BT MERAH CTRL',
727
+ 'JELEBU RD',
728
+ 'EMPRESS RD',
729
+ 'VEERASAMY RD',
730
+ 'CHOA CHU KANG ST 64',
731
+ 'CHOA CHU KANG ST 53',
732
+ 'CHOA CHU KANG NTH 7',
733
+ 'CLEMENTI AVE 6',
734
+ 'CLEMENTI ST 13',
735
+ 'GEYLANG SERAI',
736
+ 'JLN TIGA',
737
+ 'ALJUNIED RD',
738
+ 'YUNG LOH RD',
739
+ 'YUNG AN RD',
740
+ "JLN MA'MOR",
741
+ 'WHAMPOA RD',
742
+ 'LOR 3 GEYLANG',
743
+ 'PASIR RIS ST 13',
744
+ "QUEEN'S CL",
745
+ 'DOVER CL EAST',
746
+ 'SEMBAWANG VISTA',
747
+ 'TAMPINES ST 43',
748
+ 'SIMEI RD',
749
+ 'KIM KEAT AVE',
750
+ 'UPP ALJUNIED LANE',
751
+ 'POTONG PASIR AVE 2',
752
+ 'WOODLANDS DR 72',
753
+ 'MARSILING RD',
754
+ 'WOODLANDS DR 71',
755
+ 'YISHUN AVE 9',
756
+ 'YISHUN ST 20',
757
+ 'ANG MO KIO ST 21',
758
+ 'TIONG BAHRU RD',
759
+ 'KLANG LANE',
760
+ 'CHOA CHU KANG LOOP',
761
+ 'CLEMENTI ST 14',
762
+ 'SIMS PL',
763
+ 'JURONG EAST ST 31',
764
+ 'YUAN CHING RD',
765
+ 'CORPORATION DR',
766
+ 'YUNG PING RD',
767
+ 'WHAMPOA STH',
768
+ 'TESSENSOHN RD',
769
+ 'JLN DUSUN',
770
+ 'QUEENSWAY',
771
+ 'FERNVALE LINK',
772
+ 'KIM PONG RD',
773
+ 'KIM CHENG ST',
774
+ 'SAUJANA RD',
775
+ 'BUFFALO RD',
776
+ 'CLEMENTI ST 12',
777
+ 'DAKOTA CRES',
778
+ 'JURONG WEST ST 51',
779
+ 'FRENCH RD',
780
+ 'GLOUCESTER RD',
781
+ 'KG ARANG RD',
782
+ 'MOULMEIN RD',
783
+ 'KENT RD',
784
+ 'AH HOOD RD',
785
+ 'SERANGOON NTH AVE 2',
786
+ 'TAMPINES CTRL 1',
787
+ 'TAMPINES AVE 7',
788
+ 'LOR 1A TOA PAYOH',
789
+ 'WOODLANDS AVE 9',
790
+ 'YISHUN CTRL 1',
791
+ 'LOWER DELTA RD',
792
+ 'JLN DUA',
793
+ 'WOODLANDS ST 11',
794
+ 'ANG MO KIO AVE 2',
795
+ 'SELEGIE RD',
796
+ 'SIMS AVE',
797
+ 'REDHILL LANE',
798
+ "KING GEORGE'S AVE",
799
+ 'PASIR RIS ST 41',
800
+ 'PUNGGOL WALK',
801
+ 'LIM LIAK ST',
802
+ 'JLN BERSEH',
803
+ 'SENGKANG WEST WAY',
804
+ 'BUANGKOK GREEN',
805
+ 'SEMBAWANG WAY',
806
+ 'PUNGGOL WAY',
807
+ 'YISHUN ST 31',
808
+ 'TECK WHYE CRES',
809
+ 'KRETA AYER RD',
810
+ 'MONTREAL LINK',
811
+ 'UPP SERANGOON CRES',
812
+ 'SUMANG LINK',
813
+ 'SENGKANG EAST AVE',
814
+ 'YISHUN AVE 1',
815
+ 'ANCHORVALE CRES',
816
+ 'YUNG KUANG RD',
817
+ 'ANCHORVALE ST',
818
+ 'TAMPINES CTRL 8',
819
+ 'YISHUN ST 51',
820
+ 'UPP SERANGOON VIEW',
821
+ 'TAMPINES AVE 1',
822
+ 'BEDOK RESERVOIR CRES',
823
+ 'ANG MO KIO ST 61',
824
+ 'DAWSON RD',
825
+ 'FERNVALE ST',
826
+ 'SENG POH RD',
827
+ 'HOUGANG ST 32',
828
+ 'TAMPINES ST 86',
829
+ 'HENDERSON RD',
830
+ 'SUMANG WALK',
831
+ 'CHOA CHU KANG AVE 7',
832
+ 'KEAT HONG CL',
833
+ 'JURONG WEST CTRL 3',
834
+ 'KEAT HONG LINK',
835
+ 'ALJUNIED AVE 2',
836
+ 'CANBERRA CRES',
837
+ 'SUMANG LANE',
838
+ 'CANBERRA ST',
839
+ 'ANG MO KIO ST 44',
840
+ 'ANG MO KIO ST 51',
841
+ 'BT BATOK EAST AVE 6',
842
+ 'BT BATOK WEST AVE 9',
843
+ 'GEYLANG EAST AVE 2',
844
+ 'MARINE PARADE CTRL',
845
+ 'CANBERRA WALK',
846
+ 'WOODLANDS RISE',
847
+ 'TAMPINES ST 61',
848
+ 'YISHUN ST 43',
849
+ 'SENGKANG WEST RD',
850
+ 'BIDADARI PK DR',
851
+ 'CANBERRA VIEW'], value = "ANG MO KIO AVE 10", label = "Street Name"),
852
+ gr.components.Number(label="Floor", value = 1),
853
+ gr.components.Dropdown(choices=['1 ROOM', '2 ROOM', '3 ROOM', '4 ROOM', '5 ROOM', 'EXECUTIVE', 'MULTI-GENERATION'], value='1 ROOM', label="Flat Type"),
854
+ gr.components.Dropdown(choices=['2-room', 'Improved', 'Simplified', 'Standard', 'Apartment', 'Type S1', 'Type S2', 'Model A', 'Model A2', 'New Generation', 'Adjoined flat', 'Improved-Maisonette', 'Maisonette', 'Model A-Maisonette', 'Multi Generation', 'Premium Apartment', 'Premium Maisonette', 'DBSS', 'Terrace', 'Premium Apartment Loft', '3Gen'], value='Improved', label="Flat Model"),
855
+ gr.components.Number(label="Floor Area (sqm)"),
856
+ gr.components.Number(label="Lease Commence Year")
857
+ ],
858
+ outputs=[gr.components.Textbox(label="Predicted Resale Price"),
859
+ gr.components.Image(type="filepath", label="Resale Price Trend Timeseries with following year prediction"),
860
+ gr.components.Textbox(label="AI Real Estate Advisor")],
861
+ allow_flagging="never"
862
+ )
863
+
864
+ # Launch the interface
865
+ interface.launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ numpy
2
+ pandas
3
+ joblib
4
+ tensorflow
5
+ matplotlib
street_name_categories.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3684a67eecc5152581360954458444c27e6ffc0878d41ba1ed10c1ada4b32004
3
+ size 9406
town_categories.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b871705543a5ea22be51bfb06cbbc82944a05f636f62c536199a760410e13e0f
3
+ size 342