Ayush19112 commited on
Commit
acf6f81
1 Parent(s): ab7c265

Delete util.py

Browse files
Files changed (1) hide show
  1. util.py +0 -48
util.py DELETED
@@ -1,48 +0,0 @@
1
-
2
-
3
-
4
- import json
5
- import pickle
6
- import numpy as np
7
-
8
- __locations = None
9
- __data_columns = None
10
- __model = None
11
-
12
- def get_estimated_price(location, sqft, bhk, bath):
13
- try:
14
- loc_index = __data_columns.index(location.lower())
15
- except ValueError:
16
- loc_index = -1
17
-
18
- x = np.zeros(len(__data_columns))
19
- x[0] = sqft
20
- x[1] = bath
21
- x[2] = bhk
22
- if loc_index >= 0:
23
- x[loc_index] = 1
24
-
25
- return round(__model.predict([x])[0], 2)
26
-
27
- def get_location_names():
28
- return __locations
29
-
30
- def load_saved_artifacts():
31
- print("loading saved artifacts...start")
32
- global __data_columns
33
- global __locations
34
- global __model
35
-
36
- with open("./artifacts/columns.json", 'r') as f:
37
- __data_columns = json.load(f)['data_columns']
38
- __locations = __data_columns[2:]
39
-
40
- with open("./artifacts/banglore_home_prices_model.pickle", 'rb') as f:
41
- __model = pickle.load(f)
42
-
43
- print("loading saved artifacts...done")
44
-
45
- if __name__ == '__main__':
46
- load_saved_artifacts()
47
- print(get_location_names())
48
- print(get_estimated_price('1st Phase JP Nagar', 1000, 3, 3))