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