🔬
The Fair-ly Project
  • Welcome to RumorMill
    • Recent Papers Timeline
  • Fair-ly Toolkit
    • Chrome Extension
    • Python Package
      • TextAnalyzer Pipeline
      • MultimodalAnalyzer Pipeline
    • Hosted APIs
  • Research
    • Sequence Classification
      • Binary
      • Multi-class
    • Named-Entity Recognition
      • Token Classification
    • Multimodal
      • Image + Text Pair Classification
    • Datasets
      • News Media Bias Plus (2024)
      • BEADs Dataset (2024)
      • GUS Dataset (2024)
      • BABE Dataset (2022)
  • Learn
    • Blog Posts
      • Training a model for multi-label NER
      • Binary Classification w/ BERT
  • Join the Project
    • To Do List
    • Discord Server
    • GitHub Repo
  • Misc
    • Privacy Policy
Powered by GitBook
On this page
  • 1. Import:
  • 2. Initialize the Module:
  • 3. Format Image as PIL
  • 4. Run Multimodal Bias Analysis
  • 5. Example Output
Edit on GitHub
  1. Fair-ly Toolkit
  2. Python Package

MultimodalAnalyzer Pipeline

Bias analysis of image and text pairs.

1. Import:

from fairly import MultimodalAnalyzer

2. Initialize the Module:

multimodal_pipeline = MultimodalAnalyzer()

3. Format Image as PIL

# image formatting
from PIL import Image
img_path = "/content/random_person.jpg"
img = Image.open(img_path)

4. Run Multimodal Bias Analysis

result = multimodal_pipeline.analyze(text="Top 10 Smartest People Ever", image=img)

5. Example Output

{
    'text': 'Top 10 Smartest People Ever', 
    'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=1200x1499 at 0x7A82D0295360>, 
    'prob': 0.5121262669563293, 
    'label': 'Biased'
}
PreviousTextAnalyzer PipelineNextHosted APIs

Last updated 7 months ago