Fairsense-AI
Fairsense-AI is a cutting edge, an AI-driven tool designed to analyze bias in text and visual content with sustainability in mind. It also offers a platform for risk identification and risk mitigation. With a strong emphasis on Bias Identification, Risk Management, and Sustainability, Fairsense-AI helps build trustworthy AI systems.
Installation and Setup
Step 1: Install supporting tools
-
Python 3.10+
Ensure Python is installed. Download it here. -
Tesseract OCR
Required for extracting text from images.Installation Instructions:
- Ubuntu:
sudo apt-get update sudo apt-get install tesseract-ocr
- macOS (Homebrew):
brew install tesseract
- Windows:
Download and install Tesseract OCR from this link.
- Ubuntu:
-
Ollama (for CPU only)
Ollama is a tool that easily installs versions of Llama that are capable of running on CPU. If the machine does not have a GPU, this is a required step.
-
Download and install Ollama here. Make sure to also install the CLI tool.
-
After that, please pre-download the Llama 3.2 model with the command below:
ollama pull llama3.2
-
-
Optional (GPU Acceleration)
Install PyTorch with CUDA support:pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
Step 2: Install Fairsense-AI
Install the fair-sense-ai package using pip:
pip install fair-sense-ai
Quickstart Code Examples
1. Text Bias Analysis
from fairsenseai.analysis.bias import analyze_text_for_bias
# Example input text to analyze for bias
text_input = "Men are naturally better at decision-making, while women excel at emotional tasks."
# Analyze the text for bias
highlighted_text, detailed_analysis, bias_score = analyze_text_for_bias(text_input, use_summarizer=True)
# Print the analysis results
print("Highlighted Text:", highlighted_text)
print("Detailed Analysis:", detailed_analysis)
print("Bias Score:", bias_score)
2. Image Bias Analysis
import requests
from PIL import Image
from io import BytesIO
from fairsenseai.analysis.bias import analyze_image_for_bias
# URL of the image to analyze
image_url = "https://media.top1000funds.com/wp-content/uploads/2019/12/iStock-525807555.jpg"
# Fetch and load the image
response = requests.get(image_url)
image = Image.open(BytesIO(response.content))
# Analyze the image for bias
highlighted_caption, image_analysis = analyze_image_for_bias(image)
# Print the analysis results
print("Highlighted Caption:", highlighted_caption)
print("Image Analysis:", image_analysis)
3. Launch the Interactive Application
from fairsenseai.app import start_server
# Launch the Gradio application (will open in the browser)
start_server()
Bias Detection Tutorial
Data and Sample Notebooks
-
Download the Data:
Google Drive Link -
Colab Notebook:
Run the Tutorial
Usage Instructions
Launching the Application
Run the following command to start Fairsense-AI:
fairsenseai
This will launch the Gradio-powered interface in your default web browser.
Features
1. Text Analysis
- Input or paste text in the Text Analysis tab.
- Click Analyze to detect and highlight biases.
2. Image Analysis
- Upload an image in the Image Analysis tab.
- Click Analyze to detect biases in embedded text or captions.
3. Batch Text CSV Analysis
- Upload a CSV file with a
textcolumn in the Batch Text CSV Analysis tab. - Click Analyze CSV to process all entries.
4. Batch Image Analysis
- Upload multiple images in the Batch Image Analysis tab.
- Click Analyze Images for a detailed review.
5. AI Risk Management
- Enter a brief description of your project/task.
- Click Analyze Risks
- Tool will display the relevant risks. It will also display the downloadable csv file with risk details, categories and suggested actions.
Additional Setup in Colab
Run the following commands to ensure everything is ready:
!pip install --quiet fair-sense-ai
!pip uninstall sympy -y
!pip install sympy --upgrade
!apt update
!apt install -y tesseract-ocr
Note: Restart your system if you're using Google Colab.
Troubleshooting
-
Slow Model Download:
Ensure a stable internet connection for downloading models. -
Tesseract OCR Errors:
Verify Tesseract is installed and accessible in your system's PATH. -
GPU Support:
Use the CUDA-compatible version of PyTorch for better performance.
Bibliography
To acknowledge the use of Fairsense-AI in your study, please consider citing our article:
@article{raza2025fairsense,
title={FairSense-AI: Responsible AI Meets Sustainability},
author={Raza, Shaina and Chettiar, Mukund Sayeeganesh and Yousefabadi, Matin and Khan, Tahniat and Lotif, Marcelo},
journal={arXiv preprint arXiv:2503.02865},
year={2025}
}
Contact
For inquiries or support, contact:
Shaina Raza, PhD
Applied ML Scientist, Responsible AI
shaina.raza@vectorinstitute.ai
License
This project is licensed under the Creative Commons License.
Metadata
Release files for fair-sense-ai 1.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fair_sense_ai-1.0.11.tar.gz | 1.6 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fair_sense_ai-1.0.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.2 MB
Release files / fair_sense_ai-1.0.11.tar.gz
| Download URL | fair_sense_ai-1.0.11.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a342899026945383d0aa29091a8ec5f369c65c656e99a59e899962863e0b9a4c
|
|
BLAKE2b-256 checksum How to use checksums |
74626dcd3fe70699d0b3aba9ec5b9cc2242e9f5295e540e5a4287aa22fb4cf1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / fair_sense_ai-1.0.11-py3-none-any.whl
| Download URL | fair_sense_ai-1.0.11-py3-none-any.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db93fdf3414599d1b3a80f98fe62961e83dcd44eb25b2deaf8e36691a0e2c2a2
|
|
BLAKE2b-256 checksum How to use checksums |
6f95fb8a8a734af469df217255f350d0fa0e3ce25a2a6f9faf0a9b11a6e7cd21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for fair-sense-ai 1.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.