Spaces:
Configuration error
π 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 = DieselEngine Type: 0 = Manual, 1 = Automatic
π₯ Running Locally
1οΈβ£ Clone Repository
git clone https://github.com/lovnishverma/Car-Price-Prediction.git
cd Car-Price-Prediction
2οΈβ£ Install Dependencies
pip install -r requirements.txt
3οΈβ£ Run the Application
python app.py
Visit http://localhost:5000
π Running in Production
For production deployments, use Gunicorn:
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
π₯ 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.
β¨ Author
Lovnish Verma Portfolio Website GitHub