carpriceprediction / README.md
simran40's picture
Upload 7 files
b5e9f18 verified
# πŸš— Car Price Prediction using Flask and Decision Tree Regressor
This project is a simple machine learning-powered web application to predict car prices based on user inputs such as fuel type, engine type, engine size, and horsepower. The application is built with **Flask**, uses **scikit-learn's DecisionTreeRegressor**, and provides both USD and INR price predictions.
---
## πŸ”§ Technologies Used
* **Python 3**
* **Flask (Web Framework)**
* **Pandas (Data Handling)**
* **Scikit-learn (ML Model)**
* **Joblib (Model Persistence)**
* **Bootstrap 5 (Frontend Styling)**
---
## πŸ“‚ Project Structure
```
Car-Price-Prediction/
β”‚
β”œβ”€β”€ app.py # Main Flask Application
β”œβ”€β”€ car.csv # Training Data (Features & Target)
β”œβ”€β”€ model.joblib # Saved Machine Learning Model
β”œβ”€β”€ requirements.txt # Project Dependencies
β”œβ”€β”€ templates/
β”‚ └── car.html # HTML Template for Frontend
└── static/ # (Optional) For static files like CSS, JS, images
```
---
## πŸš€ Features
βœ… Predicts **Car Price (USD)** and **Car Price (INR)**
βœ… User-friendly **Bootstrap-based Interface**
βœ… Persistent trained model using **Joblib** (no retraining on every request)
βœ… **Production-ready** Flask app structure
---
## πŸ“Š Dataset (car.csv)
The `car.csv` contains synthetic or real-world data with the following columns:
| Fuel Type | Engine Type | Engine Size | Horsepower | Price (USD) |
| --------- | ----------- | ----------- | ---------- | ----------- |
| 0 / 1 | 0 / 1 | float | float | float |
* `Fuel Type`: 0 = Petrol, 1 = Diesel
* `Engine Type`: 0 = Manual, 1 = Automatic
---
## πŸ”₯ Running Locally
### 1️⃣ Clone Repository
```bash
git clone https://github.com/lovnishverma/Car-Price-Prediction.git
cd Car-Price-Prediction
```
### 2️⃣ Install Dependencies
```bash
pip install -r requirements.txt
```
### 3️⃣ Run the Application
```bash
python app.py
```
Visit [http://localhost:5000](http://localhost:5000)
---
## 🏭 Running in Production
For production deployments, use **Gunicorn**:
```bash
gunicorn -w 4 -b 0.0.0.0:5000 app:app
```
Or deploy on **Render / Railway / Huggingface** using this `requirements.txt`.
---
## πŸ’‘ Example Usage
| Input Field | Sample Value |
| ----------- | ------------ |
| Fuel Type | 0 |
| Engine Type | 1 |
| Engine Size | 1.6 |
| Horsepower | 120 |
**Output:**
Predicted Price (USD): **\$18,000**
Predicted Price (INR): **β‚Ή1,47,6720**
---
## 🌐 Live Demo
> [View on Render](https://car-price-prediction-2dgn.onrender.com/)
---
## πŸ“₯ Requirements
```
Flask==3.0.3
pandas==2.2.2
scikit-learn==1.5.0
joblib==1.4.2
```
---
## πŸ“„ License
This project is open-source under the [MIT License](LICENSE).
---
## ✨ Author
**Lovnish Verma**
[Portfolio Website](https://lovnishverma.github.io/)
[GitHub](https://github.com/lovnishverma)
---