Spaces:
Sleeping
Sleeping
demethantas
commited on
Commit
•
e07b084
1
Parent(s):
566b91b
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@
|
|
3 |
|
4 |
# # Araba Fiyatı Tahmin Eden Model ve Deployment
|
5 |
|
6 |
-
|
7 |
#import libraries
|
8 |
import pandas as pd
|
9 |
from sklearn.model_selection import train_test_split
|
@@ -13,36 +12,20 @@ from sklearn.pipeline import Pipeline
|
|
13 |
from sklearn.compose import ColumnTransformer
|
14 |
from sklearn.preprocessing import StandardScaler,OneHotEncoder
|
15 |
|
16 |
-
|
17 |
-
|
18 |
#Load data
|
19 |
df=pd.read_excel('cars.xls')
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
X=df.drop('Price',axis=1)
|
28 |
y=df[['Price']]
|
29 |
|
30 |
-
|
31 |
-
|
32 |
X_train,X_test,y_train,y_test=train_test_split(X,y,
|
33 |
test_size=0.2,
|
34 |
random_state=42)
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
preproccer=ColumnTransformer(transformers=[('num',StandardScaler(),
|
40 |
['Mileage','Cylinder','Liter','Doors']),
|
41 |
('cat',OneHotEncoder(),['Make','Model','Trim','Type'])])
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
model=LinearRegression()
|
47 |
pipe=Pipeline(steps=[('preprocessor',preproccer),
|
48 |
('model',model)])
|
@@ -68,7 +51,7 @@ def price(make,model,trim,mileage,car_type,cylinder,liter,doors,cruise,sound,lea
|
|
68 |
})
|
69 |
prediction=pipe.predict(input_data)[0]
|
70 |
return prediction
|
71 |
-
st.title("Araba Fiyatı Tahmin :red_car:
|
72 |
st.write("Arabanın özelliklerini seçin")
|
73 |
make=st.selectbox("Marka",df['Make'].unique())
|
74 |
model=st.selectbox("Model",df[df['Make']==make]['Model'].unique())
|
@@ -85,7 +68,3 @@ if st.button("Tahmin"):
|
|
85 |
pred=price(make,model,trim,mileage,car_type,cylinder,liter,doors,cruise,sound,leather)
|
86 |
|
87 |
st.write("Predicted Price :red_car: $",round(pred[0],2))
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
3 |
|
4 |
# # Araba Fiyatı Tahmin Eden Model ve Deployment
|
5 |
|
|
|
6 |
#import libraries
|
7 |
import pandas as pd
|
8 |
from sklearn.model_selection import train_test_split
|
|
|
12 |
from sklearn.compose import ColumnTransformer
|
13 |
from sklearn.preprocessing import StandardScaler,OneHotEncoder
|
14 |
|
|
|
|
|
15 |
#Load data
|
16 |
df=pd.read_excel('cars.xls')
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
X=df.drop('Price',axis=1)
|
19 |
y=df[['Price']]
|
20 |
|
|
|
|
|
21 |
X_train,X_test,y_train,y_test=train_test_split(X,y,
|
22 |
test_size=0.2,
|
23 |
random_state=42)
|
24 |
|
|
|
|
|
|
|
25 |
preproccer=ColumnTransformer(transformers=[('num',StandardScaler(),
|
26 |
['Mileage','Cylinder','Liter','Doors']),
|
27 |
('cat',OneHotEncoder(),['Make','Model','Trim','Type'])])
|
28 |
|
|
|
|
|
|
|
29 |
model=LinearRegression()
|
30 |
pipe=Pipeline(steps=[('preprocessor',preproccer),
|
31 |
('model',model)])
|
|
|
51 |
})
|
52 |
prediction=pipe.predict(input_data)[0]
|
53 |
return prediction
|
54 |
+
st.title("Araba Fiyatı Tahmin :red_car: demethantas")
|
55 |
st.write("Arabanın özelliklerini seçin")
|
56 |
make=st.selectbox("Marka",df['Make'].unique())
|
57 |
model=st.selectbox("Model",df[df['Make']==make]['Model'].unique())
|
|
|
68 |
pred=price(make,model,trim,mileage,car_type,cylinder,liter,doors,cruise,sound,leather)
|
69 |
|
70 |
st.write("Predicted Price :red_car: $",round(pred[0],2))
|
|
|
|
|
|
|
|