RMHalak commited on
Commit
cd9721e
1 Parent(s): 7dc04fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -41
app.py CHANGED
@@ -6,50 +6,21 @@ from utils import create_new_features, normalize, init_new_pred
6
  with open('./trained_model.pkl', 'rb') as file:
7
  model = pickle.load(file)
8
 
9
- # Define min and max values from the dictionaries
10
- min_dict = {
11
- 'bedrooms': 0,
12
- 'bathrooms': 0,
13
- 'sqft_living': 370,
14
- 'sqft_lot': 638,
15
- 'floors': 1,
16
- 'waterfront': 0,
17
- 'view': 0,
18
- 'condition': 1,
19
- 'sqft_above': 370,
20
- 'sqft_basement': 0,
21
- 'yr_built': 1900,
22
- 'yr_renovated': 0,
23
- 'house_age': 0,
24
- 'years_since_renovation': 0
25
- }
26
 
27
- max_dict = {
28
- 'bedrooms': 9,
29
- 'bathrooms': 8,
30
- 'sqft_living': 13540,
31
- 'sqft_lot': 1074218,
32
- 'floors': 3,
33
- 'waterfront': 1,
34
- 'view': 4,
35
- 'condition': 5,
36
- 'sqft_above': 9410,
37
- 'sqft_basement': 4820,
38
- 'yr_built': 2014,
39
- 'yr_renovated': 2014,
40
- 'house_age': 114,
41
- 'years_since_renovation': 2014
42
- }
43
 
44
  st.set_page_config(layout="wide")
45
 
46
  # Create two columns: one for the city and one for the map
47
  col1, col2 = st.columns([1, 2]) # Adjust the width ratios as needed
48
 
49
- # Display city dropdown in the first column
50
  with col1:
51
  st.subheader('Features')
52
 
 
53
  city = st.selectbox(
54
  'Select City',
55
  ['Algona', 'Auburn', 'Beaux Arts Village', 'Bellevue',
@@ -101,12 +72,8 @@ with col1:
101
 
102
  # Display the map in the second column
103
  with col2:
104
- # st.subheader('Map')
105
  # Placeholder for displaying the predicted price at the top
106
  price_placeholder = st.empty()
107
-
108
- # Display the predicted price at the top of the app
109
- # price_placeholder.write(f"Predicted Price: ${predicted_price[0][0]:,.2f}")
110
  price_placeholder.markdown(
111
  f"<h1 style='font-size: 24px;'>Predicted Price: ${predicted_price[0][0]:,.2f}</h1>",
112
  unsafe_allow_html=True
@@ -332,6 +299,4 @@ with col2:
332
  'longitude': [-122.2218]
333
  })
334
 
335
- st.map(map_data, zoom=11)
336
-
337
-
 
6
  with open('./trained_model.pkl', 'rb') as file:
7
  model = pickle.load(file)
8
 
9
+ with open("./min_dict.json", "r") as f:
10
+ min_dict = json.load(f)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ with open("./max_dict.json", "r") as f:
13
+ max_dict = json.load(f)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  st.set_page_config(layout="wide")
16
 
17
  # Create two columns: one for the city and one for the map
18
  col1, col2 = st.columns([1, 2]) # Adjust the width ratios as needed
19
 
 
20
  with col1:
21
  st.subheader('Features')
22
 
23
+ # Display city dropdown in the first column
24
  city = st.selectbox(
25
  'Select City',
26
  ['Algona', 'Auburn', 'Beaux Arts Village', 'Bellevue',
 
72
 
73
  # Display the map in the second column
74
  with col2:
 
75
  # Placeholder for displaying the predicted price at the top
76
  price_placeholder = st.empty()
 
 
 
77
  price_placeholder.markdown(
78
  f"<h1 style='font-size: 24px;'>Predicted Price: ${predicted_price[0][0]:,.2f}</h1>",
79
  unsafe_allow_html=True
 
299
  'longitude': [-122.2218]
300
  })
301
 
302
+ st.map(map_data, zoom=11)