git clone https://github.com/yourusername/car-price-predictor.git
cd car-price-predictor
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python app.py
Access at: http://localhost:5000
Metric | Score |
---|---|
RΒ² Score | 0.92 |
Mean Error | βΉ12,500 |
Training Time | 45 seconds |
Best Model | Random Forest (n_estimators=200) |
Python:
import requests
data = {
"company": "Hyundai",
"name": "Grand i10",
"year": 2018,
"kms_driven": 35000,
"fuel_type": "Petrol"
}
response = requests.post("http://localhost:5000/predict", data=data)
print(response.json())```
Javascript:
fetch('/predict', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
company: 'Hyundai',
name: 'Grand i10',
year: 2018,
kms_driven: 35000,
fuel_type: 'Petrol'
})
})
.then(response => response.json())
.then(data => console.log(data));
Successful Response:
{
"success": true,
"predicted_price": "βΉ425,000",
"confidence": 0.92,
"model": "Random Forest"
}
Error Response:
{
"success": false,
"error": "Brand must be one of: Maruti, Hyundai, Honda, ..."
}
Common error responses include:
- 400 Bad Request - Missing required parameters
- 422 Unprocessable Entity - Invalid input values
- 500 Internal Server Error - Server-side issues
Always check the success flag in the response before processing results.
And more ...- Fork the repository
- Create a feature branch (git checkout -b feature/AmazingFeature)
- Commit your changes (git commit -m 'Add amazing feature')
- Push to the branch (git push origin feature/AmazingFeature)
- Open a Pull Request