Upload 6 files
Browse files- Feature_scaler.pkl +3 -0
- Yogyakarta_Housing_Price_Prediction.py +33 -0
- Yogyakarta_housing_price_prediction_model.pkl +3 -0
- encoder.pkl +3 -0
- label_scaler.pkl +3 -0
- requirements.txt +2 -0
Feature_scaler.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8b419d6f7eca247b58daa7b3f69d4ed1e95513049594496a8355919c116d958a
|
3 |
+
size 1303
|
Yogyakarta_Housing_Price_Prediction.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#Make gradio
|
2 |
+
from joblib import load
|
3 |
+
import gradio as gr
|
4 |
+
import numpy as np
|
5 |
+
encoder_location = load("encoder.pkl")
|
6 |
+
regressor_model = load("Yogyakarta_housing_price_prediction_model.pkl")
|
7 |
+
# features ['bed', 'bath', 'carport', 'surface_area(m2)', 'building_area(m2)', 'location']
|
8 |
+
output_scaler = load("label_scaler.pkl")
|
9 |
+
input_scaler = load("Feature_scaler.pkl")
|
10 |
+
def Yogyakarta_Housing_Price_Prediction(bed,bath,carport,surface_are,building_area,location):
|
11 |
+
encoded_location = encoder_location.transform([[location]])[0]
|
12 |
+
input_features = np.array([[bed,bath,carport,surface_are,building_area,encoded_location]])
|
13 |
+
input_features = input_scaler.transform(input_features)
|
14 |
+
predicted_price = regressor_model.predict(input_features)
|
15 |
+
predicted_price = predicted_price.reshape(-1,1)
|
16 |
+
predicted_price = output_scaler.inverse_transform(predicted_price)
|
17 |
+
predicted_price = predicted_price[0][0]
|
18 |
+
if predicted_price >= 1000000000:
|
19 |
+
return f"Rp {np.round((predicted_price/1000000000),4)} Milliar"
|
20 |
+
else:
|
21 |
+
return f"Rp {np.round((predicted_price/1000000),2)} Juta"
|
22 |
+
UI = gr.Interface(fn = Yogyakarta_Housing_Price_Prediction,
|
23 |
+
inputs = [
|
24 |
+
gr.Number(label="Jumlah Kamar"),
|
25 |
+
gr.Number(label="Jumlah Kamar Mandi"),
|
26 |
+
gr.Number(label = "Jumlah Parkiran"),
|
27 |
+
gr.Slider(1,2000,step=1,label = "Luas lahan (m²)"),
|
28 |
+
gr.Slider(1,2000,step = 1, label = "Luas Bangunan (m²)"),
|
29 |
+
gr.Dropdown(["Bantul","Sleman","Yogyakarta"], label = "Lokasi")
|
30 |
+
],
|
31 |
+
outputs = gr.Label(label = "Prediksi Harga Rumah"),
|
32 |
+
title = "Prediksi Harga Rumah di DIY")
|
33 |
+
UI.launch()
|
Yogyakarta_housing_price_prediction_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b9f52fce722134932dd432c2faea87add6fc45739198bb6b6a33e550a0018ad7
|
3 |
+
size 2519889
|
encoder.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ef5b665fbda8e526dba6b0cc4af7cd673e5adab0a9d472aa260845cbdb8c94c8
|
3 |
+
size 561
|
label_scaler.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:28b60771591720c815edba1c1fdaef3a6f0448bc0886c47d73c2bbc1b934daae
|
3 |
+
size 1023
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
numpy==1.26.4
|
2 |
+
scikit-learn == 1.6.0
|