AI-powered insurance premium prediction and risk classification using Machine Learning.
🔗 Live Demo: smart-insurance-risk-predictor.vercel.app
├── main.py # Backend: ML pipeline + Flask API server
├── insurance.csv # Training dataset
├── models/ # Saved ML models (auto-generated)
├── src/
│ ├── App.tsx # React frontend UI
│ ├── main.tsx # React entry point
│ └── index.css # Styles
├── index.html # Vite HTML entry
├── requirements.txt # Python dependencies
├── package.json # Node.js dependencies
├── vite.config.ts # Vite configuration
└── tsconfig.json # TypeScript configuration
- Python 3.10+
- Node.js 18+
# Create virtual environment
python -m venv .venv
# Activate (Windows)
.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run (trains models + starts API on port 5000)
python main.py# Install dependencies
npm install
# Start dev server (port 5173)
npm run dev
# Build for production
npm run build- Start the backend:
python main.py(runs onhttp://localhost:5000) - Start the frontend:
npm run dev(runs onhttp://localhost:5173) - Open
http://localhost:5173in your browser - Fill in the form and click Predict Insurance
Request:
{
"age": 35,
"sex": "male",
"bmi": 25.0,
"children": 2,
"smoker": "no",
"region": "northwest"
}Response:
{
"Predicted Premium": 19108.61,
"Risk Class": "Low Risk"
}- Regression: Linear Regression, KNN Regressor → best saved automatically
- Classification: Logistic Regression, KNN Classifier, Naive Bayes → best saved automatically
This project has no copyright claim but please don't copy it 👉👈.