summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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}")