sivakornchong commited on
Commit
5638308
1 Parent(s): 2a7ee55
Files changed (3) hide show
  1. app.py +2 -2
  2. main.py +2 -3
  3. misc.py +0 -4
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- import main from main
3
 
4
  #Input structure
5
  ##Postal_,age_,town_,storey_,room_ = 680705, 30, 'CHOA CHU KANG', 12, '5 ROOM'
@@ -8,7 +8,7 @@ town_list = ['ANG MO KIO', 'BEDOK', 'BISHAN', 'BUKIT BATOK', 'BUKIT MERAH', 'BUK
8
  room_list = ['1 ROOM', '2 ROOM', '3 ROOM', '4 ROOM', '5 ROOM', 'EXECUTIVE', 'MULTI-GENERATION']
9
 
10
  iface = gr.Interface(
11
- fn=main,
12
  inputs= [
13
  gr.inputs.Number(default=680705, label='Postal Code'),
14
  gr.inputs.Number(default=25, label='Age'),
 
1
  import gradio as gr
2
+ import main_fn from main
3
 
4
  #Input structure
5
  ##Postal_,age_,town_,storey_,room_ = 680705, 30, 'CHOA CHU KANG', 12, '5 ROOM'
 
8
  room_list = ['1 ROOM', '2 ROOM', '3 ROOM', '4 ROOM', '5 ROOM', 'EXECUTIVE', 'MULTI-GENERATION']
9
 
10
  iface = gr.Interface(
11
+ fn=main_fn,
12
  inputs= [
13
  gr.inputs.Number(default=680705, label='Postal Code'),
14
  gr.inputs.Number(default=25, label='Age'),
main.py CHANGED
@@ -1,7 +1,6 @@
1
  import json
2
  import requests
3
  from misc import nearest_mrt
4
- import time
5
  import pickle
6
  import os
7
  import pandas as pd
@@ -9,7 +8,7 @@ import pandas as pd
9
  ###This is to create MRT names and MRT locations
10
 
11
 
12
- def main(Postal_,age_,town_,storey_,room_):
13
  ##Input structure into model is##
14
  filename = 'finalized_model.sav'
15
 
@@ -91,5 +90,5 @@ def main(Postal_,age_,town_,storey_,room_):
91
 
92
  if __name__ == "__main__":
93
  Postal_,age_,town_,storey_,room_ = 680705, 30, 'CHOA CHU KANG', 12, '5 ROOM'
94
- price = main(Postal_,age_,town_,storey_,room_)
95
  print(price)
 
1
  import json
2
  import requests
3
  from misc import nearest_mrt
 
4
  import pickle
5
  import os
6
  import pandas as pd
 
8
  ###This is to create MRT names and MRT locations
9
 
10
 
11
+ def main_fn(Postal_,age_,town_,storey_,room_):
12
  ##Input structure into model is##
13
  filename = 'finalized_model.sav'
14
 
 
90
 
91
  if __name__ == "__main__":
92
  Postal_,age_,town_,storey_,room_ = 680705, 30, 'CHOA CHU KANG', 12, '5 ROOM'
93
+ price = main_fn(Postal_,age_,town_,storey_,room_)
94
  print(price)
misc.py CHANGED
@@ -2,11 +2,7 @@ from dateutil.parser import parse
2
  import geopy.distance
3
  import json
4
  from datetime import datetime
5
- import math
6
 
7
-
8
-
9
- storey_dict = {'01 TO 03': 1, '04 TO 06': 2, '07 TO 09': 3, '10 TO 12': 4, '13 TO 15': 5, '16 TO 18': 6, '19 TO 21': 7, '22 TO 24': 8, '25 TO 27': 9, '28 TO 30': 10, '31 TO 33': 11, '34 TO 36': 12, '37 TO 39': 13, '40 TO 42': 14, '43 TO 45': 15, '46 TO 48': 16, '49 TO 51':17}
10
  RPI_dict = {'2Q2022': 163.9, '1Q2022': 159.5, '4Q2021': 155.7, '3Q2021': 150.6, '2Q2021': 146.4, '1Q2021': 142.2, '4Q2020': 138.1, '3Q2020': 133.9, '2Q2020': 131.9, '1Q2020': 131.5, '4Q2019': 131.5, '3Q2019': 130.9, '2Q2019': 130.8, '1Q2019': 131, '4Q2018': 131.4, '3Q2018': 131.6, '2Q2018': 131.7, '1Q2018': 131.6, '4Q2017': 132.6, '3Q2017': 132.8, '2Q2017': 133.7, '1Q2017': 133.9}
11
 
12
  def is_date(string, fuzzy=False):
 
2
  import geopy.distance
3
  import json
4
  from datetime import datetime
 
5
 
 
 
 
6
  RPI_dict = {'2Q2022': 163.9, '1Q2022': 159.5, '4Q2021': 155.7, '3Q2021': 150.6, '2Q2021': 146.4, '1Q2021': 142.2, '4Q2020': 138.1, '3Q2020': 133.9, '2Q2020': 131.9, '1Q2020': 131.5, '4Q2019': 131.5, '3Q2019': 130.9, '2Q2019': 130.8, '1Q2019': 131, '4Q2018': 131.4, '3Q2018': 131.6, '2Q2018': 131.7, '1Q2018': 131.6, '4Q2017': 132.6, '3Q2017': 132.8, '2Q2017': 133.7, '1Q2017': 133.9}
7
 
8
  def is_date(string, fuzzy=False):