Tapanat commited on
Commit
dca1a64
·
1 Parent(s): 2c47725

Upload 2 files

Browse files
Files changed (2) hide show
  1. app (1).py +57 -0
  2. requirements (1).txt +5 -0
app (1).py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import pandas as pd
3
+ import streamlit as st
4
+
5
+
6
+ model = joblib.load('model.joblib')
7
+ unique_values = joblib.load('unique_values.joblib')
8
+
9
+ unique_mainroad = unique_values["mainroad"]
10
+ unique_guestroom = unique_values["guestroom"]
11
+ unique_basement = unique_values["basement"]
12
+ unique_hotwaterheating = unique_values["hotwaterheating"]
13
+ unique_airconditioning = unique_values["airconditioning"]
14
+ unique_prefarea = unique_values["prefarea"]
15
+
16
+ def main():
17
+ st.title("furnishingstatus Predit")
18
+
19
+ with st.form("questionaire"):
20
+ price = st.slider("price", min_value=1750000, max_value=13300000)
21
+ area = st.slider("area", min_value=1650, max_value=16200)
22
+ bedrooms = st.slider("bedrooms", min_value=1, max_value=6)
23
+ bathrooms = st.slider("bathrooms", min_value=1, max_value=5)
24
+ stories = st.slider("stories", min_value=1, max_value=5)
25
+ mainroad = st.selectbox("mainroad", unique_mainroad)
26
+ guestroom = st.selectbox("guestroom", unique_guestroom)
27
+ basement= st.selectbox("basement", unique_basement)
28
+ hotwaterheating= st.selectbox("hotwaterheating", unique_hotwaterheating)
29
+ airconditioning= st.selectbox("airconditioning", unique_airconditioning)
30
+ parking = st.slider("parking", min_value=1, max_value=3)
31
+ prefarea = st.selectbox("prefarea", unique_prefarea)
32
+
33
+ clicked = st.form_submit_button("Predict income")
34
+ if clicked:
35
+ result=model.predict(pd.DataFrame({"price": [price],
36
+ "area": [area],
37
+ "bedrooms": [bedrooms],
38
+ "bathrooms": [bathrooms],
39
+ "stories": [stories],
40
+ "mainroad": [mainroad],
41
+ "guestroom": [guestroom],
42
+ "basement": [basement],
43
+ "hotwaterheating": [hotwaterheating],
44
+ "airconditioning": [airconditioning],
45
+ "parking": [parking],
46
+ "prefarea":[prefarea]}))
47
+ if result[0] == 0:
48
+ result_predict = 'furnished'
49
+ elif result[0] == 1:
50
+ result_predict = 'semi-furnished'
51
+ elif result[0] == 2:
52
+ result_predict = 'unfurnished'
53
+
54
+ st.success(result_predict)
55
+
56
+ if __name__=='__main__':
57
+ main()
requirements (1).txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ joblib
2
+ pandas
3
+ scikit-learn==1.2.2
4
+ xgboost==1.7.6
5
+ altair<5