π Used Cars Price Prediction
A Flask-based web application that predicts the resale price of used cars based on features such as manufacturing year, kilometers driven, company, and fuel type. The app uses a trained machine learning model to provide accurate predictions through a simple and user-friendly web interface.
π Features
β Predicts used car prices based on input parameters
β Flask backend with machine learning integration
β Input validation and error handling
β REST API endpoint (/predict) for JSON-based predictions
β Simple, responsive frontend using HTML (index.html)
π οΈ Tech Stack
Python 3.x
Flask β Web framework
NumPy β Numerical computations
Pickle β Model serialization
HTML/CSS/JS β Frontend UI
π Project Structure Used-Car-Price-Prediction/ β βββ static/ # Static files (CSS, JS, images) βββ templates/ # HTML templates (frontend UI) β βββ index.html β βββ car_price_model.pkl # Trained ML model (serialized) βββ app.py # Main Flask application βββ requirements.txt # Required dependencies βββ README.md # Project documentation
βοΈ Installation & Setup
Clone the repository
git clone https://github.com/your-username/used-car-price-prediction.git cd used-car-price-prediction
Create & activate virtual environment (optional but recommended)
python -m venv venv source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows
Install dependencies
pip install -r requirements.txt
Run the application
python app.py
Access the app in your browser
π Usage
Open the app in your browser.
Enter the required details:
Year of the car
Kilometers Driven
Company (as encoded value)
Fuel Type (as encoded value)
Click Predict.
The app will display the predicted car price.
π API Endpoint POST /predict
Request (Form Data):
{ "year": 2018, "kms_driven": 45000, "company": 2, "fuel_type": 1 }
Response (JSON):
{ "price": 450000.75 }
Error Example:
{ "error": "All fields are required. Please fill in all values." }
π¦ Dependencies
Add these to requirements.txt:
Flask numpy pickle-mixin
π Deployment
You can deploy this app on:
Heroku
PythonAnywhere
Render
AWS / Azure / GCP
π License
This project is licensed under the MIT License.
π¨βπ» Author
Anuj Kumar π§ [email protected]