summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-11-27 22:03:45 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-11-27 22:03:45 +0530
commitab9359ae5b6fa18695df4bb3543672502452cd6f (patch)
tree070fb44be77e45771c52f9a2eea1dabe31961ac3
parent5f85fe6603c6fbc68afa71d76c0b51ac8df6a41f (diff)
downloadautopredict-ab9359ae5b6fa18695df4bb3543672502452cd6f.tar.gz
autopredict-ab9359ae5b6fa18695df4bb3543672502452cd6f.tar.bz2
autopredict-ab9359ae5b6fa18695df4bb3543672502452cd6f.zip
Added predict.py to predict from model
-rw-r--r--predict.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/predict.py b/predict.py
index d7f3a9b..5d470b6 100644
--- a/predict.py
+++ b/predict.py
@@ -4,6 +4,7 @@ import pandas as pd
# Load the model
mileage_model = joblib.load('mileage_predictor.pkl')
price_model = joblib.load('price_predictor.pkl')
+year_model = joblib.load('year_predictor.pkl')
# Prepare input data for prediction
def prepare_input(data_dict):
@@ -20,12 +21,13 @@ def predict(input_data):
prepared_data = prepare_input(input_data)
mileage = mileage_model.predict(prepared_data)[0]
price = price_model.predict(prepared_data)[0]
+ year = year_model.predict(prepared_data)[0]
- return mileage, price
+ return mileage, price, int(year)
# Sample data for prediction
data = {
- 'Year': 2018,
+ 'Year': 2022,
'Kilometers_Driven': 30000,
'Fuel_Type': 'Petrol',
'Transmission': 'Manual',
@@ -38,7 +40,8 @@ data = {
# Make prediction
-predicted_mileage, predicted_price = predict(data)
+predicted_mileage, predicted_price, predicted_year = predict(data)
print(f"Predicted Mileage (Km/L): {predicted_mileage:.2f}")
print(f"Predicted Price: ₹{predicted_price:,.2f} Lakhs")
+print(f"Predicted Year: {predicted_year}")