Skip to content

Commit

Permalink
Deployed e16bdb0 with MkDocs version: 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
llm-work committed Dec 5, 2024
1 parent 3ecc231 commit 52ead07
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 109 deletions.
229 changes: 121 additions & 108 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,64 @@
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#demo-video">Demo Video</a>
</li>
<li class="toctree-l2"><a class="reference internal" href="#installation">Installation</a>
<ul>
<li class="toctree-l3"><a class="reference internal" href="#dependencies">Dependencies</a>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#usage-instructions">Usage Instructions</a>
<ul>
<li class="toctree-l3"><a class="reference internal" href="#launch-the-application">Launch the Application</a>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#bias-detection-tutorial">Bias Detection Tutorial</a>
<ul>
<li class="toctree-l3"><a class="reference internal" href="#setup">Setup</a>
</li>
<li class="toctree-l3"><a class="reference internal" href="#install-required-packages">Install Required Packages</a>
</li>
<li class="toctree-l3"><a class="reference internal" href="#code-examples">Code Examples</a>
<ul>
<li class="toctree-l4"><a class="reference internal" href="#text-bias-analysis">Text Bias Analysis</a>
</li>
<li class="toctree-l4"><a class="reference internal" href="#image-bias-analysis">Image Bias Analysis</a>
</li>
<li class="toctree-l4"><a class="reference internal" href="#launch-the-interactive-application">Launch the Interactive Application</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#how-to-use-fair-sense-ai">How to Use Fair-Sense-AI</a>
<ul>
<li class="toctree-l3"><a class="reference internal" href="#1-text-analysis">1. Text Analysis</a>
</li>
<li class="toctree-l3"><a class="reference internal" href="#2-image-analysis">2. Image Analysis</a>
</li>
<li class="toctree-l3"><a class="reference internal" href="#3-batch-text-csv-analysis">3. Batch Text CSV Analysis</a>
</li>
<li class="toctree-l3"><a class="reference internal" href="#4-batch-image-analysis">4. Batch Image Analysis</a>
</li>
<li class="toctree-l3"><a class="reference internal" href="#5-ai-governance-insights">5. AI Governance Insights</a>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#troubleshooting">Troubleshooting</a>
<ul>
<li class="toctree-l3"><a class="reference internal" href="#common-issues">Common Issues</a>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#prerequisites">Prerequisites</a>
</li>
<li class="toctree-l2"><a class="reference internal" href="#contact">Contact</a>
</li>
<li class="toctree-l2"><a class="reference internal" href="#license">License</a>
</li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -86,192 +144,147 @@

<h1 id="fair-sense-ai"><strong>Fair-Sense-AI</strong></h1>
<p>Fair-Sense-AI is a cutting-edge, AI-driven platform designed to promote transparency, fairness, and equity by analyzing bias in textual and visual content. Whether you're addressing societal biases, identifying disinformation, or fostering responsible AI practices, Fair-Sense-AI equips you with the tools to make informed decisions.</p>
<p>📦 <a href="https://pypi.org/project/fair-sense-ai/0.1.2/">Fair-Sense-AI on PyPI</a></p>
<hr />
<h2 id="key-features"><strong>Key Features</strong></h2>
<h3 id="text-analysis">📄 <strong>Text Analysis</strong></h3>
<ul>
<li>Detect and highlight biases within text, such as targeted language or phrases.</li>
<li>Provide actionable feedback on the tone and fairness of the content.</li>
<li>Detect and highlight biases within text, such as targeted language or stereotypes.</li>
<li>Provide actionable feedback to improve the fairness of content.</li>
</ul>
<h3 id="image-analysis">🖼️ <strong>Image Analysis</strong></h3>
<ul>
<li>Extract embedded text from images and analyze it for potential biases.</li>
<li>Generate captions for images and evaluate their fairness and inclusivity.</li>
<li>Extract embedded text from images and evaluate it for potential biases.</li>
<li>Generate and assess image captions for fairness and inclusivity.</li>
</ul>
<h3 id="batch-processing">📂 <strong>Batch Processing</strong></h3>
<ul>
<li>Analyze large datasets of text or images efficiently.</li>
<li>Automatically highlight problematic patterns across entire datasets.</li>
<li>Efficiently analyze large datasets of text or images.</li>
<li>Automatically flag problematic patterns across datasets.</li>
</ul>
<h3 id="ai-governance-insights">📜 <strong>AI Governance Insights</strong></h3>
<ul>
<li>Gain detailed insights into ethical AI practices, fairness guidelines, and bias mitigation strategies.</li>
<li>Explore topics like data privacy, transparency, and responsible AI deployment.</li>
<li>Gain insights into ethical AI practices and bias mitigation strategies.</li>
<li>Explore topics such as data privacy, transparency, and responsible AI deployment.</li>
</ul>
<hr />
<h1 id="demo-video">Demo Video</h1>
<p>Watch the demonstration of the FairSense platform below:</p>
<h2 id="demo-video"><strong>Demo Video</strong></h2>
<p>Watch the demonstration of Fair-Sense-AI below:</p>
<iframe src="https://drive.google.com/file/d/1B0GhvxbJ_dR8xhruOK5cEa_DApTC_xmo/preview"
width="600" height="450" allow="autoplay"></iframe>
width="500" height="400" allow="autoplay"></iframe>

<hr />
<h3 id="installing-fair-sense-ai"><strong>Installing Fair-Sense-AI</strong></h3>
<p>Install the Fair-Sense-AI package using pip:</p>
<pre><code class="language-bash">pip install Fair-Sense-AI
<h2 id="installation"><strong>Installation</strong></h2>
<p>Install Fair-Sense-AI using pip:</p>
<pre><code class="language-bash">pip install fair-sense-ai
</code></pre>
<h3 id="dependencies"><strong>Dependencies</strong></h3>
<p>Ensure the following prerequisites are met:
1. Python 3.7+
2. Tesseract OCR for image analysis (installation instructions below).</p>
<hr />
<h2 id="usage-instructions"><strong>Usage Instructions</strong></h2>
<h3 id="launching-the-application"><strong>Launching the Application</strong></h3>
<h3 id="launch-the-application"><strong>Launch the Application</strong></h3>
<p>Run the following command to start Fair-Sense-AI:</p>
<pre><code class="language-bash">Fair-Sense-AI
<pre><code class="language-bash">fair-sense-ai
</code></pre>
<p>This will launch the Gradio-powered interface in your default web browser.</p>
<p>This will launch a Gradio-powered interface in your default web browser.</p>
<hr />
<h2 id="bias-detection-tutorial"><strong>Bias Detection Tutorial</strong></h2>
<h3 id="setup"><strong>Setup</strong></h3>
<ol>
<li><strong>Download the Data</strong>: </li>
<li>Download the data from <a href="https://drive.google.com/drive/folders/1_D7lTz-TC6yhV7xsZIDzk-tJvl4TAwyi?usp=sharing">this Google Drive link</a>.</li>
<li>Upload the downloaded files to your environment (e.g., Jupyter Notebook, Google Colab, etc.).</li>
<li>Our dataset <a href="https://huggingface.co/datasets/vector-institute/newsmediabias-plus-clean">Newsmediabias-plus</a></li>
<li>Download example datasets from <a href="https://drive.google.com/drive/folders/1_D7lTz-TC6yhV7xsZIDzk-tJvl4TAwyi?usp=sharing">this Google Drive link</a> to check. Upload the files to your environment (e.g., Jupyter Notebook, Google Colab, etc.).</li>
<li>Example Google Colab notebook: <a href="https://colab.research.google.com/drive/1en8JtZTAIa5MuV5OZWYNteYl95Ql9xy7?usp=sharing">Run the Tutorial</a>.</li>
</ol>
<hr />
<h3 id="install-required-packages"><strong>Install Required Packages</strong></h3>
<pre><code class="language-bash">!pip install --quiet fair-sense-ai
!pip uninstall sympy -y
!pip install sympy --upgrade
!apt update
!apt install -y tesseract-ocr
<pre><code class="language-bash">pip install fair-sense-ai
pip uninstall sympy -y
pip install sympy --upgrade
apt update
apt install -y tesseract-ocr
</code></pre>
<p><strong>Restart your system if you are using Google Colab.</strong><br />
Example Colab Notebook: <a href="https://colab.research.google.com/drive/1en8JtZTAIa5MuV5OZWYNteYl95Ql9xy7?usp=sharing">Run the Tutorial</a></p>
<hr />
<h3 id="code-examples"><strong>Code Examples</strong></h3>
<h4 id="1-text-bias-analysis"><strong>1. Text Bias Analysis</strong></h4>
<pre><code class="language-python"># Import Required Libraries
from fairsenseai import analyze_text_for_bias
<h4 id="text-bias-analysis"><strong>Text Bias Analysis</strong></h4>
<pre><code class="language-python">from fairsenseai import analyze_text_for_bias

# Example input text to analyze for bias
text_input = &quot;Women are better at multitasking than men.&quot;

# Analyze the text for bias using FairSense AI
highlighted_text, detailed_analysis = analyze_text_for_bias(text_input)

# Print the analysis results
print(&quot;Highlighted Text:&quot;, highlighted_text)
print(&quot;Detailed Analysis:&quot;, detailed_analysis)
</code></pre>
<h4 id="2-image-bias-analysis"><strong>2. Image Bias Analysis</strong></h4>
<pre><code class="language-python"># Import Required Libraries
import requests
<h4 id="image-bias-analysis"><strong>Image Bias Analysis</strong></h4>
<pre><code class="language-python">from fairsenseai import analyze_image_for_bias
from PIL import Image
from io import BytesIO
from fairsenseai import analyze_image_for_bias
from IPython.display import display, HTML

# URL of the image to analyze
image_url = &quot;https://cdn.i-scmp.com/sites/default/files/styles/1200x800/public/images/methode/2018/05/31/20b096c2-64b4-11e8-82ea-2acc56ad2bf7_1280x720_173440.jpg?itok=2I32exTB&quot;

# Fetch and load the image
response = requests.get(image_url)
if response.status_code == 200:
# Load the image
image = Image.open(BytesIO(response.content))
image = Image.open(&quot;example_image.jpg&quot;)

# Resize the image for smaller display
small_image = image.copy()
small_image.thumbnail((200, 200)) # Maintain aspect ratio while resizing
highlighted_caption, image_analysis = analyze_image_for_bias(image)

# Display the resized image
print(&quot;Original Image (Resized):&quot;)
display(small_image)

# Analyze the image for bias
highlighted_caption, image_analysis = analyze_image_for_bias(image)

# Print the analysis results
print(&quot;Highlighted Caption:&quot;, highlighted_caption)
print(&quot;Image Analysis:&quot;, image_analysis)

# Display highlighted captions (if available)
if highlighted_caption:
display(HTML(highlighted_caption))
else:
print(f&quot;Failed to fetch the image. Status code: {response.status_code}&quot;)
print(&quot;Highlighted Caption:&quot;, highlighted_caption)
print(&quot;Image Analysis:&quot;, image_analysis)
</code></pre>
<h3 id="3-launch-the-interactive-application"><strong>3. Launch the Interactive Application</strong></h3>
<h4 id="launch-the-interactive-application"><strong>Launch the Interactive Application</strong></h4>
<pre><code class="language-python">from fairsenseai import main

# Launch the Gradio application (will open in the browser)
main()
main() # Launches the Gradio interface in a browser
</code></pre>
<hr />
<h2 id="how-to-use-fair-sense-ai"><strong>How to Use Fair-Sense-AI</strong></h2>
<h3 id="1-text-analysis"><strong>1. Text Analysis</strong></h3>
<ul>
<li>Navigate to the <strong>Text Analysis</strong> tab in the Gradio interface.</li>
<li>Input or paste the text you want to analyze.</li>
<li>Input text into the <strong>Text Analysis</strong> tab of the Gradio interface.</li>
<li>Click <strong>Analyze</strong> to detect and highlight biases.</li>
</ul>
<h3 id="2-image-analysis"><strong>2. Image Analysis</strong></h3>
<ul>
<li>Navigate to the <strong>Image Analysis</strong> tab.</li>
<li>Upload an image to analyze for biases in embedded text or captions.</li>
<li>Click <strong>Analyze</strong> to view detailed results.</li>
<li>Upload an image in the <strong>Image Analysis</strong> tab.</li>
<li>Click <strong>Analyze</strong> to evaluate biases in captions or embedded text.</li>
</ul>
<h3 id="3-batch-text-csv-analysis"><strong>3. Batch Text CSV Analysis</strong></h3>
<ul>
<li>Navigate to the <strong>Batch Text CSV Analysis</strong> tab.</li>
<li>Upload a CSV file with a column named <code>text</code>.</li>
<li>Click <strong>Analyze CSV</strong> to process and analyze all entries.</li>
<li>Upload a CSV file with a <code>text</code> column.</li>
<li>Click <strong>Analyze CSV</strong> to process and flag all entries.</li>
</ul>
<h3 id="4-batch-image-analysis"><strong>4. Batch Image Analysis</strong></h3>
<ul>
<li>Navigate to the <strong>Batch Image Analysis</strong> tab.</li>
<li>Upload multiple images to analyze biases in captions or embedded text.</li>
<li>Upload multiple images in the <strong>Batch Image Analysis</strong> tab.</li>
<li>Click <strong>Analyze Images</strong> to view results.</li>
</ul>
<h3 id="5-ai-governance-insights"><strong>5. AI Governance Insights</strong></h3>
<ul>
<li>Navigate to the <strong>AI Governance and Safety</strong> tab.</li>
<li>Choose a predefined topic or input your own.</li>
<li>Click <strong>Get Insights</strong> for actionable recommendations.</li>
<li>Select a predefined topic or input your own.</li>
<li>Click <strong>Get Insights</strong> for detailed recommendations.</li>
</ul>
<hr />
<h2 id="troubleshooting"><strong>Troubleshooting</strong></h2>
<h3 id="common-issues"><strong>Common Issues</strong></h3>
<ul>
<li><strong>Models Download Slowly</strong>: </li>
<li>
<p>On first use, models are downloaded automatically. Ensure you have a stable internet connection.</p>
<p><strong>Slow Model Downloads</strong>:<br />
First-time users may experience slow downloads. Ensure a stable internet connection.</p>
</li>
<li>
<p><strong>Tesseract Not Found</strong>: </p>
<p><strong>Tesseract Missing</strong>:<br />
Verify Tesseract is installed and accessible in your system's PATH.</p>
</li>
<li>
<p>Verify Tesseract is installed and accessible in your system's PATH.</p>
<p><strong>GPU Acceleration</strong>:<br />
Install PyTorch with CUDA support for faster processing.</p>
</li>
<li>
<p><strong>GPU Support</strong>: </p>
</li>
<li>Install PyTorch with CUDA support if you want GPU acceleration.</li>
</ul>
<p><code>bash
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117</code></p>
<pre><code class="language-bash">pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
</code></pre>
<hr />
<h2 id="further-instructions"><strong>Further instructions</strong></h2>
<p><strong>sample data</strong></p>
<ul>
<li>A sample CSV file with a <code>text</code> column.</li>
<li>Sample images for analysis.</li>
</ul>
<p><strong>Prerequisites</strong></p>
<h2 id="prerequisites"><strong>Prerequisites</strong></h2>
<ol>
<li><strong>Python 3.7+</strong></li>
<li>
<p>Ensure you have Python installed. Download it <a href="https://www.python.org/downloads/">here</a>.</p>
</li>
<li>
<p><strong>Tesseract OCR</strong> </p>
</li>
<li>Required for extracting text from images.</li>
<li><strong>Python 3.7+</strong>: Download <a href="https://www.python.org/downloads/">here</a>.</li>
<li><strong>Tesseract OCR</strong>: Required for image text extraction.</li>
</ol>
<p>#### Installation Instructions:
- <strong>Ubuntu</strong>:
Expand All @@ -282,7 +295,7 @@ <h2 id="further-instructions"><strong>Further instructions</strong></h2>
<code>bash
brew install tesseract</code>
- <strong>Windows</strong>:
- Download and install Tesseract OCR from <a href="https://github.com/UB-Mannheim/tesseract/wiki">this link</a>.</p>
Download Tesseract OCR from <a href="https://github.com/UB-Mannheim/tesseract/wiki">this link</a>.</p>
<hr />
<h2 id="contact"><strong>Contact</strong></h2>
<p>For inquiries or support, contact:<br />
Expand Down Expand Up @@ -341,5 +354,5 @@ <h2 id="license"><strong>License</strong></h2>

<!--
MkDocs version : 1.6.0
Build Date UTC : 2024-12-05 13:22:17.049211+00:00
Build Date UTC : 2024-12-05 13:31:48.248876+00:00
-->
Loading

0 comments on commit 52ead07

Please sign in to comment.