A clean, production-ready version of the Car Price Prediction application. This project predicts vehicle prices for the Tunisian market using a trained Extra Trees machine learning model.
- Python 3.11+
- Node.js 16+
- Install Python dependencies:
pip install -r requirements.txt- Install frontend dependencies:
cd frontend
npm installTerminal 1 - Start Backend:
python app.pyBackend runs on http://localhost:5000
Terminal 2 - Start Frontend:
cd frontend
npm run devFrontend runs on http://localhost:5173
Car-Prediction-Project-Clean/
├── app.py # Flask API server
├── predictor.py # ML prediction module
├── requirements.txt # Python dependencies
├── models/
│ ├── extra_trees_tuned.pkl # Trained model
│ └── encoders.pkl # Preprocessing encoders
└── frontend/
├── src/
│ ├── App.jsx
│ ├── main.jsx
│ ├── styles.css
│ └── components/
│ ├── PredictionForm.jsx
│ └── Results.jsx
├── index.html
├── package.json
└── vite.config.js
GET /health- Health checkGET /api/brands- Get supported brandsPOST /api/predict- Predict price for a single vehiclePOST /api/predict_batch- Batch prediction
from predictor import CarPricePredictor
predictor = CarPricePredictor()
result = predictor.predict(
marque='BMW',
modele='Série 3',
annee=2021,
kilometrage=45000,
energie='Diesel',
boite_vitesses='Automatique',
puissance_fiscale=9
)
print(f"Estimated price: {result['prix_predit']:,.0f} DT")Educational and research purposes.