HWU-NLP/BeautyStandards

Sources for "Erasing 'Ugly' from the Internet: Propagation of the Beauty Myth in Text-Image Models"

1

stars

34

commits

Jupyter Notebook

primary language

Nov 10, 2025

updated

README

BeautyStandards

Sources for "Erasing 'Ugly' from the Internet: Propagation of the Beauty Myth in Text-Image Models"

πŸ“ Repository Structure

BeautyStandards/Code/
β”‚
β”œβ”€β”€ Prompt_template/
β”‚   β”œβ”€β”€ beauty_taxonomy.py             # Creates the structured beauty taxonomy for prompt generation
β”‚   β”œβ”€β”€ base_prompts.txt               # Core set of base prompt templates
β”‚   β”œβ”€β”€ prompts_metadata.json          # Metadata associated with taxonomy prompts
β”‚   β”œβ”€β”€ llama3.1_prompts.txt           # Prompts for LLaMA 3.1 model
β”‚   β”œβ”€β”€ llama3.1_instruct_prompts.txt  # Prompts for LLaMA 3.1 Instruct model
β”‚   β”œβ”€β”€ deepseek_llm_prompts.txt       # Prompts for DeepSeek LLM
β”‚   └── image_prompts.txt              # Finalised prompts used for image generation
β”‚
β”œβ”€β”€ Generate_data/
β”‚   β”œβ”€β”€ run_llms/
β”‚   β”‚   β”œβ”€β”€ run_llms.py                # Runs LLMs with taxonomy-based prompts
β”‚   β”‚   β”œβ”€β”€ compute_selfBLEU.py        # Computes Self-BLEU to select most diverse LLM outputs
β”‚   β”‚   β”œβ”€β”€ output_text_llama3.1.txt   # LLaMA 3.1 generated text outputs
β”‚   β”‚   β”œβ”€β”€ output_text_llama3.1_instruct.txt
β”‚   β”‚   β”œβ”€β”€ output_text_deepseek_llm.txt # DeepSeek LLM outputs
β”‚   β”‚   └── output_text_selfBleu.txt   # Selected diverse LLM outputs after Self-BLEU filtering
β”‚   β”œβ”€β”€ run_image_models/
β”‚   β”‚   β”œβ”€β”€ run_stable_diff3.5_full.py # Generates images via Stable Diffusion 3.5
β”‚   β”‚   β”œβ”€β”€ run_freepik.py             # Generates images via Freepik API
β”‚   β”‚   └── image_prompts.txt          # Input prompts for image generation
β”‚
β”œβ”€β”€ Results/
β”‚   β”œβ”€β”€ analyse.ipynb                  # Main analysis notebook (Krippendorff’s Ξ±, ANOVA, Tukey HSD)
β”‚   β”œβ”€β”€ krippendorff_alpha.py          # Computes Krippendorff’s alpha for inter-rater reliability
β”‚   β”œβ”€β”€ anova/                         # ANOVA outputs
β”‚   β”œβ”€β”€ fdr_bh/                        # FDR correction 
β”‚   β”œβ”€β”€ tukey_hsd/                     # Tukey HSD post-hoc analysis output
β”‚   └── formatted_data_from_human.tsv  # Annotated dataset with anonymised Prolific IDs
β”‚
β”œβ”€β”€ LICENSE
└── README.md

βš™οΈ How to Run the Code

1️⃣ Generate Prompts Using the Beauty Taxonomy

Run the beauty_taxonomy.py script to produce prompts based on diverse beauty-related traits.

cd Code/Prompt_template
python beauty_taxonomy.py

This will create prompt files (e.g., image_prompts.txt, llama3.1_prompts.txt, etc.) that will be used in the next stages. Copy the image_prompts.txt into the run_image_models folder, and other prompt .txt files llama3.1, llama3.1_instruct, deepseek into the run_llms folder.

2️⃣ Generate Text Outputs with LLMs

Move to the run_llms folder and run the language model generation pipeline.

cd ../Generate_data/run_llms
python run_llms.py

This will produce raw text outputs for each model:

  • output_text_llama3.1.txt β€” LLaMA 3.1 outputs
  • output_text_llama3.1_instruct.txt β€” LLaMA 3.1 Instruct outputs
  • output_text_deepseek_llm.txt β€” DeepSeek LLM outputs

🧩 Select the Most Diverse Outputs

Use the Self-BLEU script to identify the most diverse LLM responses for subsequent image generation:

python compute_selfBLEU.py

The filtered outputs will be written to output_text_selfBLEu.txt.

3️⃣ Generate Images

Pipelines

Use both pipelines to produce AI-generated images:

Pipeline 1 (Prompt-generated images): Prompt β†’ Image model (uses image_prompts.txt as prompt input)

Pipeline 2 (Description-generated images): Prompt β†’ LLM description β†’ Image model (uses output_text_selfBLEu.txt as prompt input)

Navigate to run_image_models and run the scripts:

cd ../run_image_models
python run_stable_diff3.5_full.py
python run_freepik.py

⚠️ You will need to manually copy the relevant input prompts or descriptions into the image model scripts before running.

4️⃣ Analyse Results

The Code/Results folder runs all the statistical analysis given in the paper, including anova results and inter rater agreement.

Option 1: Run the Notebook

jupyter notebook analyse.ipynb

The file formatted_data_from_human.tsv contains anonymised human evaluation data.

πŸ“œ Citation

⚠️ If you are interested in the image dataset, please contact I.Konstas [at] hw.ac.uk

If you use this code or data, please cite the corresponding paper:

Erasing 'Ugly' from the Internet: Propagation of the Beauty Myth in Text-Image Models
Tanvi Dinkar, Aiqi Jiang, Gavin Abercrombie, Ioannis Konstas
arXiv preprint arXiv:2511.00749, 2025

Contributors

tdinkar

30 commits

aggiejiang

4 commits

HWU-NLP/BeautyStandards

Sources for "Erasing 'Ugly' from the Internet: Propagation of the Beauty Myth in Text-Image Models"

1

stars

34

commits

Jupyter Notebook

primary language

Nov 10, 2025

updated

README

BeautyStandards

Sources for "Erasing 'Ugly' from the Internet: Propagation of the Beauty Myth in Text-Image Models"

πŸ“ Repository Structure

BeautyStandards/Code/
β”‚
β”œβ”€β”€ Prompt_template/
β”‚   β”œβ”€β”€ beauty_taxonomy.py             # Creates the structured beauty taxonomy for prompt generation
β”‚   β”œβ”€β”€ base_prompts.txt               # Core set of base prompt templates
β”‚   β”œβ”€β”€ prompts_metadata.json          # Metadata associated with taxonomy prompts
β”‚   β”œβ”€β”€ llama3.1_prompts.txt           # Prompts for LLaMA 3.1 model
β”‚   β”œβ”€β”€ llama3.1_instruct_prompts.txt  # Prompts for LLaMA 3.1 Instruct model
β”‚   β”œβ”€β”€ deepseek_llm_prompts.txt       # Prompts for DeepSeek LLM
β”‚   └── image_prompts.txt              # Finalised prompts used for image generation
β”‚
β”œβ”€β”€ Generate_data/
β”‚   β”œβ”€β”€ run_llms/
β”‚   β”‚   β”œβ”€β”€ run_llms.py                # Runs LLMs with taxonomy-based prompts
β”‚   β”‚   β”œβ”€β”€ compute_selfBLEU.py        # Computes Self-BLEU to select most diverse LLM outputs
β”‚   β”‚   β”œβ”€β”€ output_text_llama3.1.txt   # LLaMA 3.1 generated text outputs
β”‚   β”‚   β”œβ”€β”€ output_text_llama3.1_instruct.txt
β”‚   β”‚   β”œβ”€β”€ output_text_deepseek_llm.txt # DeepSeek LLM outputs
β”‚   β”‚   └── output_text_selfBleu.txt   # Selected diverse LLM outputs after Self-BLEU filtering
β”‚   β”œβ”€β”€ run_image_models/
β”‚   β”‚   β”œβ”€β”€ run_stable_diff3.5_full.py # Generates images via Stable Diffusion 3.5
β”‚   β”‚   β”œβ”€β”€ run_freepik.py             # Generates images via Freepik API
β”‚   β”‚   └── image_prompts.txt          # Input prompts for image generation
β”‚
β”œβ”€β”€ Results/
β”‚   β”œβ”€β”€ analyse.ipynb                  # Main analysis notebook (Krippendorff’s Ξ±, ANOVA, Tukey HSD)
β”‚   β”œβ”€β”€ krippendorff_alpha.py          # Computes Krippendorff’s alpha for inter-rater reliability
β”‚   β”œβ”€β”€ anova/                         # ANOVA outputs
β”‚   β”œβ”€β”€ fdr_bh/                        # FDR correction 
β”‚   β”œβ”€β”€ tukey_hsd/                     # Tukey HSD post-hoc analysis output
β”‚   └── formatted_data_from_human.tsv  # Annotated dataset with anonymised Prolific IDs
β”‚
β”œβ”€β”€ LICENSE
└── README.md

βš™οΈ How to Run the Code

1️⃣ Generate Prompts Using the Beauty Taxonomy

Run the beauty_taxonomy.py script to produce prompts based on diverse beauty-related traits.

cd Code/Prompt_template
python beauty_taxonomy.py

This will create prompt files (e.g., image_prompts.txt, llama3.1_prompts.txt, etc.) that will be used in the next stages. Copy the image_prompts.txt into the run_image_models folder, and other prompt .txt files llama3.1, llama3.1_instruct, deepseek into the run_llms folder.

2️⃣ Generate Text Outputs with LLMs

Move to the run_llms folder and run the language model generation pipeline.

cd ../Generate_data/run_llms
python run_llms.py

This will produce raw text outputs for each model:

  • output_text_llama3.1.txt β€” LLaMA 3.1 outputs
  • output_text_llama3.1_instruct.txt β€” LLaMA 3.1 Instruct outputs
  • output_text_deepseek_llm.txt β€” DeepSeek LLM outputs

🧩 Select the Most Diverse Outputs

Use the Self-BLEU script to identify the most diverse LLM responses for subsequent image generation:

python compute_selfBLEU.py

The filtered outputs will be written to output_text_selfBLEu.txt.

3️⃣ Generate Images

Pipelines

Use both pipelines to produce AI-generated images:

Pipeline 1 (Prompt-generated images): Prompt β†’ Image model (uses image_prompts.txt as prompt input)

Pipeline 2 (Description-generated images): Prompt β†’ LLM description β†’ Image model (uses output_text_selfBLEu.txt as prompt input)

Navigate to run_image_models and run the scripts:

cd ../run_image_models
python run_stable_diff3.5_full.py
python run_freepik.py

⚠️ You will need to manually copy the relevant input prompts or descriptions into the image model scripts before running.

4️⃣ Analyse Results

The Code/Results folder runs all the statistical analysis given in the paper, including anova results and inter rater agreement.

Option 1: Run the Notebook

jupyter notebook analyse.ipynb

The file formatted_data_from_human.tsv contains anonymised human evaluation data.

πŸ“œ Citation

⚠️ If you are interested in the image dataset, please contact I.Konstas [at] hw.ac.uk

If you use this code or data, please cite the corresponding paper:

Erasing 'Ugly' from the Internet: Propagation of the Beauty Myth in Text-Image Models
Tanvi Dinkar, Aiqi Jiang, Gavin Abercrombie, Ioannis Konstas
arXiv preprint arXiv:2511.00749, 2025

Contributors

tdinkar

30 commits

aggiejiang

4 commits

Languages

Jupyter Notebook

87.6%

Python

12.4%