LethallyHealthy commited on
Commit
cbc82da
·
1 Parent(s): 27150d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -37
app.py CHANGED
@@ -11,47 +11,39 @@ import predictor
11
  data = pd.DataFrame(np.zeros((1,60)),columns=predictor.X_test.columns, index=[0])
12
 
13
 
14
- OverallQual = st.slider("Overall Quality", 1, 5)
15
- data["OverallQual"] = OverallQual
16
- GrLivingArea = st.slider("Above ground Living Area (sqft):", 0, 5000)
17
- data["GrLivArea"] = GrLivingArea
18
- YearBuilt = st.number_input("Year Built: ", value=2000, min_value=1800, max_value=2023)
19
- data["YearBuilt"] = YearBuilt
20
- TotalBsmtSF = st.number_input("Total Basement Square Footage:", value=0, min_value=0)
21
- data["TotalBsmtSF"] = TotalBsmtSF
22
- BsmtFinSF1 = st.number_input("Square Footage of Type 1 Basement (same as total if one type):", value=0, min_value=0)
23
- data["BsmtFinSF1"] = BsmtFinSF1
24
- data["YearRemodAdd"] = st.number_input("Year of Remodeling/Additions (same as year built if no remodeling)", value = 2000, min_value= 1800,max_value=2023)
25
- data["LotArea"] = st.slider("Lot Area:", 0, 5000)
26
- data["OverallCond"] = st.slider("Overall Condition of the House (5 being the best):", 1, 5)
27
- data["1stFlrSF"] = st.number_input("First Floor Square Footage:", min_value=0,value=0)
28
- data["GarageCars"] = st.slider("Number of Cars the Garage Can Hold:", 0, 10)
29
- data["2ndFlrSF"] = st.number_input("Second Floor Square Footage:", value=0, min_value=0)
30
- data["Fireplaces"] = st.slider("Number of Fireplaces:", 0, 10)
31
- data["Neighborhood"] = st.slider("Neighborhood:", 0, 24)
32
- data["GarageArea"] = st.number_input("Garage Area (sqft):", value= 0, min_value=0)
33
- data["BsmtFullBath"] = st.slider("Number of Full Bathrooms in the Basement:", 0, 5)
34
- data["FullBath"] = st.slider("Number of Full Bathroooms Above Ground:", 0, 5)
35
- data["HalfBath"] = st.slider("Number of Half Bathrooms Above Ground (no shower):", 0, 5)
36
- data["KitchenQual"] = st.slider("Quality of the Kitchen", 1, 5)
37
- data["OpenPorchSF"] = st.number_input("Open Porch Square Footage:", value=0, min_value=0)
38
- data["MoSold"] = st.slider("Month Sold:", 1,12)
 
39
 
40
  #The button
41
- if st.button("Calculate"):
42
  results = predictor.make_a_prediction(data)
43
- print(results[0])
 
44
 
45
- add_selectbox = st.sidebar.selectbox(
46
- "How would you like to be contacted?",
47
- ("Email", "Home phone", "Mobile phone")
48
- )
49
 
50
- # Using "with" notation
51
- with st.sidebar:
52
- add_radio = st.radio(
53
- "Choose a shipping method",
54
- ("Standard (5-15 days)", "Express (2-5 days)")
55
- )
56
 
57
 
 
11
  data = pd.DataFrame(np.zeros((1,60)),columns=predictor.X_test.columns, index=[0])
12
 
13
 
14
+ OverallQual = st.sidebar.slider("Overall Quality", 1, 5)
15
+ with st.sidebar:
16
+ data["OverallQual"] = OverallQual
17
+ GrLivingArea = st.slider("Above ground Living Area (sqft):", 0, 5000)
18
+ data["GrLivArea"] = GrLivingArea
19
+ YearBuilt = st.number_input("Year Built: ", value=2000, min_value=1800, max_value=2023)
20
+ data["YearBuilt"] = YearBuilt
21
+ TotalBsmtSF = st.number_input("Total Basement Square Footage:", value=0, min_value=0)
22
+ data["TotalBsmtSF"] = TotalBsmtSF
23
+ BsmtFinSF1 = st.number_input("Square Footage of Type 1 Basement (same as total if one type):", value=0, min_value=0)
24
+ data["BsmtFinSF1"] = BsmtFinSF1
25
+ data["YearRemodAdd"] = st.number_input("Year of Remodeling/Additions (same as year built if no remodeling)", value = 2000, min_value= 1800,max_value=2023)
26
+ data["LotArea"] = st.slider("Lot Area:", 0, 5000)
27
+ data["OverallCond"] = st.slider("Overall Condition of the House (5 being the best):", 1, 5)
28
+ data["1stFlrSF"] = st.number_input("First Floor Square Footage:", min_value=0,value=0)
29
+ data["GarageCars"] = st.slider("Number of Cars the Garage Can Hold:", 0, 10)
30
+ data["2ndFlrSF"] = st.number_input("Second Floor Square Footage:", value=0, min_value=0)
31
+ data["Fireplaces"] = st.slider("Number of Fireplaces:", 0, 10)
32
+ data["Neighborhood"] = st.slider("Neighborhood:", 0, 24)
33
+ data["GarageArea"] = st.number_input("Garage Area (sqft):", value= 0, min_value=0)
34
+ data["BsmtFullBath"] = st.slider("Number of Full Bathrooms in the Basement:", 0, 5)
35
+ data["FullBath"] = st.slider("Number of Full Bathroooms Above Ground:", 0, 5)
36
+ data["HalfBath"] = st.slider("Number of Half Bathrooms Above Ground (no shower):", 0, 5)
37
+ data["KitchenQual"] = st.slider("Quality of the Kitchen", 1, 5)
38
+ data["OpenPorchSF"] = st.number_input("Open Porch Square Footage:", value=0, min_value=0)
39
+ data["MoSold"] = st.slider("Month Sold:", 1,12)
40
 
41
  #The button
42
+ if st.button("Calculate Your House Price!"):
43
  results = predictor.make_a_prediction(data)
44
+ st.write('{0:.2f}'.format(results[0]))
45
+
46
 
 
 
 
 
47
 
 
 
 
 
 
 
48
 
49