Spaces:
Sleeping
Sleeping
sbgonenc96
commited on
Commit
•
a6a7b53
1
Parent(s):
0449e2e
hot-fix
Browse files- prediction model's printed error rate was removed
- emojis replaced
- min milage is set to 1
- prediction model is trained on all data
app.py
CHANGED
@@ -40,9 +40,11 @@ model=LinearRegression()
|
|
40 |
pipe=Pipeline(steps=[('preprocessor',preproccer),
|
41 |
('model',model)])
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
46 |
|
47 |
import streamlit as st
|
48 |
def price(make,model,trim,mileage,car_type,cylinder,liter,doors,cruise,sound,leather):
|
@@ -63,12 +65,12 @@ def price(make,model,trim,mileage,car_type,cylinder,liter,doors,cruise,sound,lea
|
|
63 |
prediction=pipe.predict(input_data)[0]
|
64 |
return prediction
|
65 |
|
66 |
-
st.title("Car Price Prediction :
|
67 |
st.write("Select Car Specs")
|
68 |
make=st.selectbox("Brand",df['Make'].unique())
|
69 |
model=st.selectbox("Model",df[df['Make']==make]['Model'].unique())
|
70 |
trim=st.selectbox("Trim",df[(df['Make']==make) & (df['Model']==model)]['Trim'].unique())
|
71 |
-
mileage=st.number_input("Milage",
|
72 |
car_type=st.selectbox("Type",df[(df['Make']==make) & (df['Model']==model) & (df['Trim']==trim )]['Type'].unique())
|
73 |
cylinder=st.selectbox("Cylinders",df['Cylinder'].unique())
|
74 |
liter=st.number_input("Liter",1,6)
|
@@ -79,4 +81,4 @@ leather=st.radio("Leather",[True,False])
|
|
79 |
if st.button("Prediction"):
|
80 |
pred=price(make,model,trim,mileage,car_type,cylinder,liter,doors,cruise,sound,leather)
|
81 |
|
82 |
-
st.write("
|
|
|
40 |
pipe=Pipeline(steps=[('preprocessor',preproccer),
|
41 |
('model',model)])
|
42 |
|
43 |
+
## Train with all data
|
44 |
+
|
45 |
+
pipe.fit(X,y)
|
46 |
+
#y_pred=pipe.predict(X_test)
|
47 |
+
#mean_squared_error(y_test,y_pred)**0.5,r2_score(y_test,y_pred)
|
48 |
|
49 |
import streamlit as st
|
50 |
def price(make,model,trim,mileage,car_type,cylinder,liter,doors,cruise,sound,leather):
|
|
|
65 |
prediction=pipe.predict(input_data)[0]
|
66 |
return prediction
|
67 |
|
68 |
+
st.title("Car Price Prediction :racing_car: \n by @sbgonenc")
|
69 |
st.write("Select Car Specs")
|
70 |
make=st.selectbox("Brand",df['Make'].unique())
|
71 |
model=st.selectbox("Model",df[df['Make']==make]['Model'].unique())
|
72 |
trim=st.selectbox("Trim",df[(df['Make']==make) & (df['Model']==model)]['Trim'].unique())
|
73 |
+
mileage=st.number_input("Milage",1 ,60000)
|
74 |
car_type=st.selectbox("Type",df[(df['Make']==make) & (df['Model']==model) & (df['Trim']==trim )]['Type'].unique())
|
75 |
cylinder=st.selectbox("Cylinders",df['Cylinder'].unique())
|
76 |
liter=st.number_input("Liter",1,6)
|
|
|
81 |
if st.button("Prediction"):
|
82 |
pred=price(make,model,trim,mileage,car_type,cylinder,liter,doors,cruise,sound,leather)
|
83 |
|
84 |
+
st.write("Predicted Price :oncoming_automobile: $",round(pred[0],2))
|