summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-11-27 23:09:38 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-11-27 23:09:38 +0530
commit54c94edb7a222c7c5585ee18648ce809e5d4ad0e (patch)
tree49b41f9f782dd37ae735c4cc8b97712c6a001a8e
parentab9359ae5b6fa18695df4bb3543672502452cd6f (diff)
downloadautopredict-54c94edb7a222c7c5585ee18648ce809e5d4ad0e.tar.gz
autopredict-54c94edb7a222c7c5585ee18648ce809e5d4ad0e.tar.bz2
autopredict-54c94edb7a222c7c5585ee18648ce809e5d4ad0e.zip
Added the price preediction output to the predict.py
-rw-r--r--main.py2
-rw-r--r--predict.py41
2 files changed, 29 insertions, 14 deletions
diff --git a/main.py b/main.py
index a8bdec8..b0d6673 100644
--- a/main.py
+++ b/main.py
@@ -90,7 +90,7 @@ def train_model(df, target, model_name):
# Save the model
model_file = f'{model_name}.pkl'
joblib.dump(best_model, model_file)
- print("Model saved as '{model_file}'")
+ print(f"Model saved as '{model_file}'")
# Main Function
def main():
diff --git a/predict.py b/predict.py
index 5d470b6..9ab313c 100644
--- a/predict.py
+++ b/predict.py
@@ -25,23 +25,38 @@ def predict(input_data):
return mileage, price, int(year)
-# Sample data for prediction
-data = {
- 'Year': 2022,
- 'Kilometers_Driven': 30000,
- 'Fuel_Type': 'Petrol',
- 'Transmission': 'Manual',
- 'Owner_Type': 'First',
- 'Location': 'Mumbai',
- 'Engine CC': 1200,
- 'Power': 85,
- 'Seats': 5
-}
+def collect_input():
+ print("Enter the car details for prediction:")
+ year = int(input("Year of Manufacture (e.g., 2022): "))
+ kilometers_driven = int(input("Kilometers Driven (e.g., 30000): "))
+ fuel_type = input("Fuel Type (Petrol/Diesel/CNG/Electric): ")
+ transmission = input("Transmission (Manual/Automatic): ")
+ owner_type = input("Owner Type (First/Second/Third/Fourth & Above): ")
+ location = input("Location (e.g., Mumbai): ")
+ engine_cc = int(input("Engine Capacity in CC (e.g., 1200): "))
+ power = float(input("Power in BHP (e.g., 85): "))
+ seats = int(input("Number of Seats (e.g., 5): "))
+
+ return {
+ 'Year': year,
+ 'Kilometers_Driven': kilometers_driven,
+ 'Fuel_Type': fuel_type,
+ 'Transmission': transmission,
+ 'Owner_Type': owner_type,
+ 'Location': location,
+ 'Engine CC': engine_cc,
+ 'Power': power,
+ 'Seats': seats
+ }
+
+
+# Collect input data from the user
+data = collect_input()
# Make prediction
-
predicted_mileage, predicted_price, predicted_year = predict(data)
+print("\nPrediction Results:")
print(f"Predicted Mileage (Km/L): {predicted_mileage:.2f}")
print(f"Predicted Price: ₹{predicted_price:,.2f} Lakhs")
print(f"Predicted Year: {predicted_year}")