Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,45 +3,45 @@ import pandas as pd
|
|
3 |
import streamlit as st
|
4 |
|
5 |
model = joblib.load('model.joblib')
|
6 |
-
unique_values =
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
unique_race = unique_values["race"]
|
15 |
-
unique_country = unique_values["native.country"]
|
16 |
|
17 |
def main():
|
18 |
-
st.title("
|
19 |
|
20 |
with st.form("questionaire"):
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
# clicked==True only when the button is clicked
|
33 |
clicked = st.form_submit_button("Predict income")
|
34 |
if clicked:
|
35 |
-
result=model.predict(pd.DataFrame({"
|
36 |
-
"
|
37 |
-
"
|
38 |
-
"
|
39 |
-
"
|
40 |
-
"
|
41 |
-
"
|
42 |
-
"
|
43 |
-
"
|
44 |
-
"
|
45 |
# Show prediction
|
|
|
46 |
|
47 |
-
|
|
|
|
3 |
import streamlit as st
|
4 |
|
5 |
model = joblib.load('model.joblib')
|
6 |
+
unique_values = joblib.load('unique_values.joblib')
|
7 |
|
8 |
+
unique_area_type = unique_values["Area Type"]
|
9 |
+
unique_city = unique_values["City"]
|
10 |
+
unique_furnishing = unique_values["Furnishing Status"]
|
11 |
+
unique_tenant = unique_values["Tenant Preferred"]
|
12 |
+
unique_contact = unique_values["Point of Contact"]
|
13 |
+
|
|
|
|
|
14 |
|
15 |
def main():
|
16 |
+
st.title("House Rent Prediction")
|
17 |
|
18 |
with st.form("questionaire"):
|
19 |
+
BHK = st.slider("BHK",min_value=1,max_value=6)
|
20 |
+
Size = st.slider("Size",min_value=10,max_value=8000)
|
21 |
+
Bathroom = st.slider("Bathroom",min_value=1,max_value=10)
|
22 |
+
FloorLevels = st.slider("Floor Level",min_value=1,max_value=89)
|
23 |
+
TotalFloor = st.slider("Total Floors",min_value=1,max_value=89)
|
24 |
+
AreaType = st.selectbox("Area Type",options=unique_area_type)
|
25 |
+
city = st.selectbox("City",options=unique_city)
|
26 |
+
FurnishingStatus = st.selectbox("Furnishing Status",options=unique_furnishing)
|
27 |
+
TenantPreferred = st.selectbox("Tenant Preferred",options=unique_tenant)
|
28 |
+
PointofContact = st.selectbox("Point of Contact",options=unique_contact)
|
29 |
|
30 |
# clicked==True only when the button is clicked
|
31 |
clicked = st.form_submit_button("Predict income")
|
32 |
if clicked:
|
33 |
+
result=model.predict(pd.DataFrame({"BHK": [BHK],
|
34 |
+
"Size": [Size],
|
35 |
+
"Bathroom": [Bathroom],
|
36 |
+
"Floor Level": [FloorLevels],
|
37 |
+
"Total Floors": [TotalFloor],
|
38 |
+
"Area Type": [AreaType],
|
39 |
+
"City": [city],
|
40 |
+
"Furnishing Status": [FurnishingStatus],
|
41 |
+
"Tenant Preferred": [TenantPreferred],
|
42 |
+
"Point of Contact": [PointofContact]}))
|
43 |
# Show prediction
|
44 |
+
st.success('Your predicted rent is'+result)
|
45 |
|
46 |
+
if __name__ == "__main__":
|
47 |
+
main()
|