FairLens AI is a hackathon-level MVP designed to detect, explain, and mitigate bias in datasets and machine learning models. Built for HR teams, banks, and healthcare analysts to ensure fairness and compliance.
FairLens/
│
├── backend/ # FastAPI Backend
│ ├── main.py # Core API & ML Fairness Module
│ └── requirements.txt # Python dependencies
│
└── frontend/ # React.js Frontend
├── public/
├── src/
│ ├── App.jsx # Main UI & State Management
│ ├── index.css # Tailwind CSS & custom styling
│ └── main.jsx # React Entry
├── package.json # Node dependencies
├── tailwind.config.js # Tailwind Config
└── postcss.config.js # PostCSS Config
Open a terminal and navigate to the backend folder:
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reloadThe backend will run on http://localhost:8000.
Open another terminal and navigate to the frontend folder:
cd frontend
npm install
npm run devThe frontend will run on http://localhost:5173.
The core ML logic is located in backend/main.py. It uses:
- Fairlearn: For calculating metrics like
demographic_parity_differenceanddisparate_impact_ratio. - CorrelationRemover: A pre-processing technique to remove the correlation between sensitive features and the rest of the dataset.
POST /analyze
{
"metrics": {
"demographic_parity_difference": 0.21,
"disparate_impact_ratio": 0.58,
"bias_score": 58.0,
"risk_level": "High"
},
"distribution": {
"Male": { "count": 500, "favorable_count": 250, "approval_rate": 0.5 },
"Female": { "count": 500, "favorable_count": 145, "approval_rate": 0.29 }
},
"explanation": "Analyzed outcomes across 'Gender'. Group 'Female' is 21.0% less likely to receive the favorable outcome compared to group 'Male'."
}POST /mitigate
{
"before": {
"accuracy": 0.84,
"demographic_parity_difference": 0.18
},
"after": {
"accuracy": 0.82,
"demographic_parity_difference": 0.04
},
"technique": "CorrelationRemover"
}- Push your code to GitHub.
- Go to Render and create a new Web Service.
- Connect your repository.
- Set the Root Directory to
backend. - Build Command:
pip install -r requirements.txt - Start Command:
uvicorn main:app --host 0.0.0.0 --port 10000 - Deploy.
- Go to Vercel and create a new Project.
- Import the GitHub repository.
- Set the Root Directory to
frontend. - Add an Environment Variable:
VITE_API_URLpointing to your Render backend URL (if you changeAPI_URLinApp.jsxtoimport.meta.env.VITE_API_URL). - Click Deploy.
- Intro (0:00-0:15): "Meet FairLens AI, the platform ensuring fairness in your AI systems. Today we're analyzing a loan approval dataset."
- Detection (0:15-0:30): "We upload the data and instantly detect a 21% disparity in approvals between genders. FairLens explains this in plain English and flags it as High Risk."
- Mitigation (0:30-0:45): "With one click, we train a debiased model. The platform applies Correlation Removal, dropping the bias by 75% while maintaining 82% accuracy."
- Outro (0:45-1:00): "FairLens AI: Making AI fair, accountable, and transparent..."