Aomsin commited on
Commit
f949676
·
1 Parent(s): 6d97fff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -31
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
- unique_class = unique_values["workclass"]
9
- unique_education = unique_values["education"]
10
- unique_marital_status = unique_values["marital.status"]
11
- unique_relationship = unique_values["relationship"]
12
- unique_occupation = unique_values["occupation"]
13
- unique_sex = unique_values["sex"]
14
- unique_race = unique_values["race"]
15
- unique_country = unique_values["native.country"]
16
 
17
  def main():
18
- st.title("Adult Income")
19
 
20
  with st.form("questionaire"):
21
- age = # user's input
22
- workclass = # user's input
23
- education = # user's input
24
- Marital_Status = # user's input
25
- occupation = # user's input
26
- relationship = # user's input
27
- race = # user's input
28
- sex = # user's input
29
- hours_per_week = # user's input
30
- native_country = # user's input
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({"age": [age],
36
- "workclass": [workclass],
37
- "education": [EDU_DICT[education]],
38
- "marital.status": [Marital_Status],
39
- "occupation": [occupation],
40
- "relationship": [relationship],
41
- "race": [race],
42
- "sex": [sex],
43
- "hours.per.week": [hours_per_week],
44
- "native.country": [native_country]}))
45
  # Show prediction
 
46
 
47
- # Run main()
 
 
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()