A FastAPI-based application for predicting customer attrition using ensemble machine learning models.
- Python 3.8+
- pip (Python package installer)
- Virtual environment
- Clone the repository:
git clone <repository-url>
cd icdmaiproject
- Create and activate a virtual environment:
Windows:
python -m venv .venv
.venv\Scripts\activate
Linux/Mac:
python -m venv .venv
source .venv/bin/activate
- Install required packages:
pip install -r requirements.txt
- Set up environment variables:
Create a
.env
file in the backend directory with:
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
MODEL_PATH=path/to/your/models
- Navigate to the backend directory:
cd backend
- Start the FastAPI server:
uvicorn app:app --reload --port 8000
The API will be available at http://localhost:8000
- GET
/predict/attrition/{customer_id}
: Predict attrition for a specific customer - GET
/predict/attrition/batch
: Batch prediction for all active customers
Once the server is running, you can access:
- Interactive API docs:
http://localhost:8000/docs
- Alternative API docs:
http://localhost:8000/redoc