sashavor commited on
Commit
9c168fe
1 Parent(s): c983155

adding first section draft

Browse files
app.py CHANGED
@@ -1,16 +1,33 @@
1
  import gradio as gr
 
 
2
 
 
 
 
3
 
4
  with gr.Blocks() as demo:
5
  gr.Markdown("""
6
  ## Stable Bias: Analyzing Societal Representations in Diffusion Models
7
  """)
8
  gr.HTML('''
9
- <p style="margin-bottom: 10px; font-size: 94%">This is the demo page for the "Stable Bias" paper, which aims to explore and quantify social biases in text-to-image systems.</p>
10
  ''')
 
11
  gr.HTML('''
12
- <p style="margin-bottom: 10px; font-size: 94%">This work was done by <a href='https://huggingface.co/sasha' style='text-decoration: underline;' target='_blank'> Alexandra Sasha Luccioni (Hugging Face) </a>, <a href='https://huggingface.co/cakiki' style='text-decoration: underline;' target='_blank'> Christopher Akiki (ScaDS.AI, Leipzig University)</a>, <a href='https://huggingface.co/meg' style='text-decoration: underline;' target='_blank'> Margaret Mitchell (Hugging Face) </a> and <a href='https://huggingface.co/yjernite' style='text-decoration: underline;' target='_blank'> Yacine Jernite (Hugging Face) </a> .</p>
13
- ''')
14
-
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- demo.launch(debug=True)
 
1
  import gradio as gr
2
+ from PIL import Image
3
+ import os
4
 
5
+ def get_identity_images(path="images/identities"):
6
+ ims = Image.open([os.path.join(path,im) for im in os.listdir(path)])
7
+ return ims
8
 
9
  with gr.Blocks() as demo:
10
  gr.Markdown("""
11
  ## Stable Bias: Analyzing Societal Representations in Diffusion Models
12
  """)
13
  gr.HTML('''
14
+ <p style="margin-bottom: 10px; font-size: 94%">This is the demo page for the "Stable Bias" paper, which aims to explore and quantify social biases in text-to-image systems. <br> This work was done by <a href='https://huggingface.co/sasha' style='text-decoration: underline;' target='_blank'> Alexandra Sasha Luccioni (Hugging Face) </a>, <a href='https://huggingface.co/cakiki' style='text-decoration: underline;' target='_blank'> Christopher Akiki (ScaDS.AI, Leipzig University)</a>, <a href='https://huggingface.co/meg' style='text-decoration: underline;' target='_blank'> Margaret Mitchell (Hugging Face) </a> and <a href='https://huggingface.co/yjernite' style='text-decoration: underline;' target='_blank'> Yacine Jernite (Hugging Face) </a> .</p>
15
  ''')
16
+
17
  gr.HTML('''
18
+ <p style="margin-bottom: 14px; font-size: 100%"> As AI-enabled Text-to-Image systems are becoming increasingly used, characterizing the social biases they exhibit is a necessary first step to lowering their risk of discriminatory outcomes. <br> We propose a new method for exploring and quantifying social biases in these kinds of systems by directly comparing collections of generated images designed to showcase a system’s variation across social attributes — gender and ethnicity — and target attributes for bias evaluation professions and gender-coded adjectives. <br> We compare three models: Stable Diffusion v.1.4, Stable Diffusion v.2., and Dall-E 2, and present some of our key findings below:</p>
19
+ ''')
20
+
21
+ with gr.Accordion("Identity group results (ethnicity and gender)", open=False):
22
+ gr.HTML('''
23
+ <p style="margin-bottom: 14px; font-size: 100%"> One of the approaches that we adopted in our work is hierarchical clustering of the images generated by the text-to-image systems in response to prompts that include identity terms with regards to ethnicity and gender. <br> We computed 3 different numbers of clusters (12, 24 and 48) and created an <a href='https://huggingface.co/spaces/society-ethics/DiffusionFaceClustering' style='text-decoration: underline;' target='_blank'> Identity Representation Demo </a> that allows for the exploration of the different clusters and their contents. <br> </p>
24
+ ''')
25
+ with gr.Row():
26
+ impath = "images/identities"
27
+ identity_gallery = gr.Gallery([os.path.join(impath,im) for im in os.listdir(impath)],
28
+ label="Identity cluster images images", show_label=False, elem_id="gallery"
29
+ ).style(grid=3, height="auto")
30
+
31
+
32
 
33
+ demo.launch(debug=True)
images/identities/Cluster1-12.png ADDED
images/identities/Cluster12-24.png ADDED
images/identities/Cluster6-48.png ADDED