-
Notifications
You must be signed in to change notification settings - Fork 1
/
carpricepred_deploy.py
79 lines (52 loc) · 1.76 KB
/
carpricepred_deploy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import pandas as pd
import numpy as np
import streamlit as st
import pickle
st.write("""
# Car Price Prediction using Machine Learning
#
""")
from PIL import Image
image = Image.open('Pricecar2.jpg')
st.image(image, use_column_width=True)
st.write("""
### Made by ❤ Sagar Dhandare
##
""")
Present_Price = st.text_input("Present market price of the Car (in Lakhs)", "10")
Kms_Driven = st.text_input("Kms driven by car", "20000")
owners = st.selectbox('Number of Previous Owners?', ("0", "1", "3"))
if owners == "0":
owners = 0
elif owners == "1":
owners = 1
elif owners == "3":
owners = 3
years_old = st.text_input("How Old is the Car? (in Years)", "3")
fuel_type = st.selectbox('Fuel type of Car', ("Diesel", "Petrol", "CNG"))
if fuel_type == "Diesel":
Fuel_type_diesel = 1
Fuel_type_Petrol = 0
elif fuel_type == "Petrol":
Fuel_type_diesel = 0
Fuel_type_Petrol = 1
elif fuel_type == "CNG":
Fuel_type_diesel = 0
Fuel_type_Petrol = 0
Individual = st.selectbox('Are you an Individual or a Dealer?', ("Individual", "Dealer"))
if Individual =="Individual":
Seller_Type_Individual = 1
elif Individual == "Dealer":
Seller_Type_Individual = 0
Transmission = st.selectbox('What kind of transmission does it have?', ('Manual', 'Automatic'))
if Transmission =='Manual':
Transmission_Manual = 1
else:
Transmission_Manual = 0
if st.button("Predict"):
pickle_in = open("Random_forest_regression_model.pkl", "rb")
rf_classifier = pickle.load(pickle_in)
pred123 = rf_classifier.predict([[Present_Price,Kms_Driven,owners,years_old,Fuel_type_diesel,Fuel_type_Petrol,Seller_Type_Individual,Transmission_Manual]])
st.write(f"""
### The predicted selling price for the car is : Rs. {pred123[0]} lakhs
""")