Spaces:
Runtime error
Runtime error
commit 24/11/22
Browse files- eda.py +9 -8
- prediction.py +3 -3
eda.py
CHANGED
@@ -27,6 +27,15 @@ def run():
|
|
27 |
|
28 |
st.subheader('Area Income')
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
def barc(df, x, y):
|
31 |
plot = df.groupby(x).mean().reset_index()
|
32 |
plot = plot.sort_values(y)
|
@@ -36,14 +45,6 @@ def run():
|
|
36 |
plt.ylabel('Mean')
|
37 |
st.pyplot(fig)
|
38 |
|
39 |
-
eda = df.copy()
|
40 |
-
eda['Pricerange'] = 'Very High'
|
41 |
-
eda.loc[eda['Price'].between(1.5e+06, 1.75e+06), 'Pricerange'] = 'High'
|
42 |
-
eda.loc[eda['Price'].between(1.25e+06, 1.5e+06), 'Pricerange'] = 'Above Average'
|
43 |
-
eda.loc[eda['Price'].between(1e+06, 1.25e+06), 'Pricerange'] = 'Below Average'
|
44 |
-
eda.loc[eda['Price'].between(0.75e+06, 1e+06), 'Pricerange'] = 'Low'
|
45 |
-
eda.loc[eda['Price']<0.75e+06, 'Pricerange'] = 'Very Low'
|
46 |
-
|
47 |
barc(eda,'Pricerange','Income')
|
48 |
|
49 |
st.markdown('---')
|
|
|
27 |
|
28 |
st.subheader('Area Income')
|
29 |
|
30 |
+
eda = df.copy()
|
31 |
+
eda['Pricerange'] = 'Very High'
|
32 |
+
eda.loc[eda['Price'].between(1.5e+06, 1.75e+06), 'Pricerange'] = 'High'
|
33 |
+
eda.loc[eda['Price'].between(1.25e+06, 1.5e+06), 'Pricerange'] = 'Above Average'
|
34 |
+
eda.loc[eda['Price'].between(1e+06, 1.25e+06), 'Pricerange'] = 'Below Average'
|
35 |
+
eda.loc[eda['Price'].between(0.75e+06, 1e+06), 'Pricerange'] = 'Low'
|
36 |
+
eda.loc[eda['Price']<0.75e+06, 'Pricerange'] = 'Very Low'
|
37 |
+
st.dataframe(eda)
|
38 |
+
|
39 |
def barc(df, x, y):
|
40 |
plot = df.groupby(x).mean().reset_index()
|
41 |
plot = plot.sort_values(y)
|
|
|
45 |
plt.ylabel('Mean')
|
46 |
st.pyplot(fig)
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
barc(eda,'Pricerange','Income')
|
49 |
|
50 |
st.markdown('---')
|
prediction.py
CHANGED
@@ -9,8 +9,8 @@ import joblib
|
|
9 |
import json
|
10 |
|
11 |
# Load All Files
|
12 |
-
with open('
|
13 |
-
|
14 |
|
15 |
with open('pipeline.pkl', 'rb') as file_2:
|
16 |
preprocessor = joblib.load(file_2)
|
@@ -57,7 +57,7 @@ def run():
|
|
57 |
X_inf = preprocessor.transform(data_inf)
|
58 |
|
59 |
# Predict using Linear regression
|
60 |
-
y_pred_inf =
|
61 |
|
62 |
st.write('# House Price : ', str(int(y_pred_inf)))
|
63 |
|
|
|
9 |
import json
|
10 |
|
11 |
# Load All Files
|
12 |
+
with open('model.pkl', 'rb') as file_1:
|
13 |
+
model = joblib.load(file_1)
|
14 |
|
15 |
with open('pipeline.pkl', 'rb') as file_2:
|
16 |
preprocessor = joblib.load(file_2)
|
|
|
57 |
X_inf = preprocessor.transform(data_inf)
|
58 |
|
59 |
# Predict using Linear regression
|
60 |
+
y_pred_inf = model.predict(X_inf)
|
61 |
|
62 |
st.write('# House Price : ', str(int(y_pred_inf)))
|
63 |
|