removing unneccessary
Browse files
zipped_images/stablediffusion1.4/README.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: StableDiffusionBiasExplorer
|
| 3 |
-
emoji: 📊
|
| 4 |
-
colorFrom: pink
|
| 5 |
-
colorTo: yellow
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 3.3.1
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: cc-by-sa-4.0
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zipped_images/stablediffusion1.4/app.py
DELETED
|
@@ -1,64 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import random, os, shutil
|
| 3 |
-
from PIL import Image
|
| 4 |
-
import pandas as pd
|
| 5 |
-
|
| 6 |
-
def open_ims(adj, group, seed):
|
| 7 |
-
if group != '':
|
| 8 |
-
if adj != '':
|
| 9 |
-
prompt=adj+'_'+group.replace(' ','_')
|
| 10 |
-
if os.path.isdir(prompt) == False:
|
| 11 |
-
shutil.unpack_archive('zipped_images/'+ prompt.replace(' ', '_') +'.zip', prompt, 'zip')
|
| 12 |
-
else:
|
| 13 |
-
prompt=group
|
| 14 |
-
if os.path.isdir(prompt) == False:
|
| 15 |
-
shutil.unpack_archive('zipped_images/'+ prompt.replace(' ', '_') +'.zip', prompt, 'zip')
|
| 16 |
-
imnames= os.listdir(prompt+'/Seed_'+ str(seed)+'/')
|
| 17 |
-
images = [(Image.open(prompt+'/Seed_'+ str(seed)+'/'+name)) for name in imnames]
|
| 18 |
-
return images[:9]
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
vowels = ["a","e","i","o","u"]
|
| 22 |
-
prompts = pd.read_csv('promptsadjectives.csv')
|
| 23 |
-
|
| 24 |
-
seeds = [46267, 48040, 51237, 54325, 60884, 64830, 67031, 72935, 92118, 93109]
|
| 25 |
-
|
| 26 |
-
m_adjectives = prompts['Masc-adj'].tolist()[:10]
|
| 27 |
-
f_adjectives = prompts['Fem-adj'].tolist()[:10]
|
| 28 |
-
adjectives = sorted(m_adjectives+f_adjectives)
|
| 29 |
-
#adjectives = ['attractive','strong']
|
| 30 |
-
adjectives.insert(0, '')
|
| 31 |
-
professions = sorted([p.lower() for p in prompts['Occupation-Noun'].tolist()])
|
| 32 |
-
|
| 33 |
-
with gr.Blocks() as demo:
|
| 34 |
-
gr.Markdown("# Stable Diffusion Explorer")
|
| 35 |
-
gr.Markdown("## Choose from the prompts below to explore how the [Stable Diffusion v1.4 model](https://huggingface.co/CompVis/stable-diffusion-v-1-4-original) represents different professions and adjectives")
|
| 36 |
-
# seed_choice = gr.State(0)
|
| 37 |
-
# seed_choice = 93109
|
| 38 |
-
# print("Seed choice is: " + str(seed_choice))
|
| 39 |
-
with gr.Row():
|
| 40 |
-
with gr.Column():
|
| 41 |
-
adj1 = gr.Dropdown(adjectives, label = "Choose a first adjective (or leave this blank!)", interactive=True)
|
| 42 |
-
choice1 = gr.Dropdown(professions, label = "Choose a first group", interactive=True)
|
| 43 |
-
seed1= gr.Dropdown(seeds, label = "Choose a random seed to compare results", value = seeds[1], interactive=True)
|
| 44 |
-
images1 = gr.Gallery(label="Images").style(grid=[3], height="auto")
|
| 45 |
-
with gr.Column():
|
| 46 |
-
adj2 = gr.Dropdown(adjectives, label = "Choose a second adjective (or leave this blank!)", interactive=True)
|
| 47 |
-
choice2 = gr.Dropdown(professions, label = "Choose a second group", interactive=True)
|
| 48 |
-
seed2= gr.Dropdown(seeds, label = "Choose a random seed to compare results", value= seeds[1], interactive=True)
|
| 49 |
-
images2 = gr.Gallery(label="Images").style(grid=[3], height="auto")
|
| 50 |
-
|
| 51 |
-
gr.Markdown("### [Research](http://gender-decoder.katmatfield.com/static/documents/Gaucher-Friesen-Kay-JPSP-Gendered-Wording-in-Job-ads.pdf) has shown that \
|
| 52 |
-
certain words are considered more masculine- or feminine-coded based on how appealing job descriptions containing these words \
|
| 53 |
-
seemed to male and female research participants and to what extent the participants felt that they 'belonged' in that occupation.")
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
#demo.load(random_image, None, [images])
|
| 57 |
-
choice1.change(open_ims, [adj1,choice1,seed1], [images1])
|
| 58 |
-
choice2.change(open_ims, [adj2,choice2,seed2], [images2])
|
| 59 |
-
adj1.change(open_ims, [adj1,choice1,seed1], [images1])
|
| 60 |
-
adj2.change(open_ims, [adj2,choice2,seed2], [images2])
|
| 61 |
-
seed1.change(open_ims, [adj1,choice1,seed1], [images1])
|
| 62 |
-
seed2.change(open_ims, [adj2,choice2,seed2], [images2])
|
| 63 |
-
|
| 64 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zipped_images/stablediffusion1.4/requirements.txt
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
pillow
|
| 2 |
-
pandas
|
|
|
|
|
|
|
|
|