This is the code implementation for Text-to-Image Association Test (T2IAT).
To run the script for image generations,
python3 txt2img.py
To run the association test with the image generations, go through the bias-test.ipynb
jupyter notebook.
To deploy the gradio demo, run
gradio demo.py
and open localhost:7860
in your local web browser.
pip3 install git+https://github.com/openai/CLIP.git
pip3 install --upgrade diffusers[torch]
pip3 install gradio # only used for demo
@inproceedings{wang-etal-2022-assessing,
title = "T2IAT: Measuring Valence and Stereotypical Biases in Text-to-Image Generation",
author = "Wang, Jialu and
Liu, Xinyue Gabby and
Di, Zonglin and
Liu, Yang and
Wang, Xin",
booktitle = "Findings of the Association for Computational Linguistics: ACL 2023",
month = July,
year = "2023",
publisher = "Association for Computational Linguistics",
}