RMHalak commited on
Commit
5a66be2
·
verified ·
1 Parent(s): 3afbcb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +67 -0
app.py CHANGED
@@ -8,6 +8,73 @@ with open('./trained_model.pkl', 'rb') as file:
8
 
9
  new_pred = st.text_area('Enter text')
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  if new_pred:
12
  new_pred = init_new_pred()
13
  new_pred['bedrooms'] = 5
 
8
 
9
  new_pred = st.text_area('Enter text')
10
 
11
+ # Define min and max values from the dictionaries
12
+ min_dict = {
13
+ 'bedrooms': 0,
14
+ 'bathrooms': 0,
15
+ 'sqft_living': 370,
16
+ 'sqft_lot': 638,
17
+ 'floors': 1,
18
+ 'waterfront': 0,
19
+ 'view': 0,
20
+ 'condition': 1,
21
+ 'sqft_above': 370,
22
+ 'sqft_basement': 0,
23
+ 'yr_built': 1900,
24
+ 'yr_renovated': 0,
25
+ 'house_age': 0,
26
+ 'years_since_renovation': 0
27
+ }
28
+
29
+ max_dict = {
30
+ 'bedrooms': 9,
31
+ 'bathrooms': 8,
32
+ 'sqft_living': 13540,
33
+ 'sqft_lot': 1074218,
34
+ 'floors': 3,
35
+ 'waterfront': 1,
36
+ 'view': 4,
37
+ 'condition': 5,
38
+ 'sqft_above': 9410,
39
+ 'sqft_basement': 4820,
40
+ 'yr_built': 2014,
41
+ 'yr_renovated': 2014,
42
+ 'house_age': 114,
43
+ 'years_since_renovation': 2014
44
+ }
45
+
46
+ # Create sliders for each item in the dictionaries
47
+ bedrooms = st.slider('Bedrooms', min_value=min_dict['bedrooms'], max_value=max_dict['bedrooms'], value=min_dict['bedrooms'])
48
+ bathrooms = st.slider('Bathrooms', min_value=min_dict['bathrooms'], max_value=max_dict['bathrooms'], value=min_dict['bathrooms'])
49
+ sqft_living = st.slider('Square Feet (Living)', min_value=min_dict['sqft_living'], max_value=max_dict['sqft_living'], value=min_dict['sqft_living'])
50
+ sqft_lot = st.slider('Square Feet (Lot)', min_value=min_dict['sqft_lot'], max_value=max_dict['sqft_lot'], value=min_dict['sqft_lot'])
51
+ floors = st.slider('Floors', min_value=min_dict['floors'], max_value=max_dict['floors'], value=min_dict['floors'])
52
+ waterfront = st.slider('Waterfront', min_value=min_dict['waterfront'], max_value=max_dict['waterfront'], value=min_dict['waterfront'])
53
+ view = st.slider('View', min_value=min_dict['view'], max_value=max_dict['view'], value=min_dict['view'])
54
+ condition = st.slider('Condition', min_value=min_dict['condition'], max_value=max_dict['condition'], value=min_dict['condition'])
55
+ sqft_above = st.slider('Square Feet (Above)', min_value=min_dict['sqft_above'], max_value=max_dict['sqft_above'], value=min_dict['sqft_above'])
56
+ sqft_basement = st.slider('Square Feet (Basement)', min_value=min_dict['sqft_basement'], max_value=max_dict['sqft_basement'], value=min_dict['sqft_basement'])
57
+ yr_built = st.slider('Year Built', min_value=min_dict['yr_built'], max_value=max_dict['yr_built'], value=min_dict['yr_built'])
58
+ yr_renovated = st.slider('Year Renovated', min_value=min_dict['yr_renovated'], max_value=max_dict['yr_renovated'], value=min_dict['yr_renovated'])
59
+ house_age = st.slider('House Age', min_value=min_dict['house_age'], max_value=max_dict['house_age'], value=min_dict['house_age'])
60
+ years_since_renovation = st.slider('Years Since Renovation', min_value=min_dict['years_since_renovation'], max_value=max_dict['years_since_renovation'], value=min_dict['years_since_renovation'])
61
+
62
+ # Display the selected values (optional)
63
+ st.write(f"Selected Bedrooms: {bedrooms}")
64
+ st.write(f"Selected Bathrooms: {bathrooms}")
65
+ st.write(f"Selected Sqft Living: {sqft_living}")
66
+ st.write(f"Selected Sqft Lot: {sqft_lot}")
67
+ st.write(f"Selected Floors: {floors}")
68
+ st.write(f"Selected Waterfront: {waterfront}")
69
+ st.write(f"Selected View: {view}")
70
+ st.write(f"Selected Condition: {condition}")
71
+ st.write(f"Selected Sqft Above: {sqft_above}")
72
+ st.write(f"Selected Sqft Basement: {sqft_basement}")
73
+ st.write(f"Selected Year Built: {yr_built}")
74
+ st.write(f"Selected Year Renovated: {yr_renovated}")
75
+ st.write(f"Selected House Age: {house_age}")
76
+ st.write(f"Selected Years Since Renovation: {years_since_renovation}")
77
+
78
  if new_pred:
79
  new_pred = init_new_pred()
80
  new_pred['bedrooms'] = 5