add link to model
#2
by
clem
HF Staff
- opened
This view is limited to 50 files because it contains too many changes.
See the raw diff here.
- .ipynb_checkpoints/tests-checkpoint.ipynb +287 -0
- README.md +1 -1
- app.py +13 -50
- promptsadjectives.csv +5 -6
- requirements.txt +0 -1
- zipped_images/accountant.zip +3 -0
- zipped_images/aerospace_engineer.zip +3 -0
- zipped_images/aide.zip +3 -0
- zipped_images/air_conditioning_installer.zip +3 -0
- zipped_images/ambitious_accountant.zip +3 -0
- zipped_images/ambitious_aerospace_engineer.zip +3 -0
- zipped_images/ambitious_aide.zip +3 -0
- zipped_images/ambitious_air_conditioning_installer.zip +3 -0
- zipped_images/ambitious_architect.zip +3 -0
- zipped_images/ambitious_artist.zip +3 -0
- zipped_images/ambitious_author.zip +3 -0
- zipped_images/ambitious_baker.zip +3 -0
- zipped_images/ambitious_bartender.zip +3 -0
- zipped_images/ambitious_bus_driver.zip +3 -0
- zipped_images/ambitious_butcher.zip +3 -0
- zipped_images/ambitious_career_counselor.zip +3 -0
- zipped_images/ambitious_carpenter.zip +3 -0
- zipped_images/ambitious_carpet_installer.zip +3 -0
- zipped_images/ambitious_cashier.zip +3 -0
- zipped_images/ambitious_ceo.zip +3 -0
- zipped_images/ambitious_childcare_worker.zip +3 -0
- zipped_images/ambitious_civil_engineer.zip +3 -0
- zipped_images/ambitious_claims_appraiser.zip +3 -0
- zipped_images/ambitious_cleaner.zip +3 -0
- zipped_images/ambitious_clergy.zip +3 -0
- zipped_images/ambitious_clerk.zip +3 -0
- zipped_images/ambitious_coach.zip +3 -0
- zipped_images/ambitious_community_manager.zip +3 -0
- zipped_images/ambitious_compliance_officer.zip +3 -0
- zipped_images/ambitious_computer_programmer.zip +3 -0
- zipped_images/ambitious_computer_support_specialist.zip +3 -0
- zipped_images/ambitious_computer_systems_analyst.zip +3 -0
- zipped_images/ambitious_construction_worker.zip +3 -0
- zipped_images/ambitious_cook.zip +3 -0
- zipped_images/ambitious_correctional_officer.zip +3 -0
- zipped_images/ambitious_courier.zip +3 -0
- zipped_images/ambitious_credit_counselor.zip +3 -0
- zipped_images/ambitious_customer_service_representative.zip +3 -0
- zipped_images/ambitious_data_entry_keyer.zip +3 -0
- zipped_images/ambitious_dental_assistant.zip +3 -0
- zipped_images/ambitious_dental_hygienist.zip +3 -0
- zipped_images/ambitious_dentist.zip +3 -0
- zipped_images/ambitious_designer.zip +3 -0
- zipped_images/ambitious_detective.zip +3 -0
- zipped_images/ambitious_director.zip +3 -0
.ipynb_checkpoints/tests-checkpoint.ipynb
ADDED
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 60,
|
6 |
+
"id": "49140416",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [],
|
9 |
+
"source": [
|
10 |
+
"import os,re\n",
|
11 |
+
"import pandas as pd\n",
|
12 |
+
"import numpy as np"
|
13 |
+
]
|
14 |
+
},
|
15 |
+
{
|
16 |
+
"cell_type": "code",
|
17 |
+
"execution_count": 29,
|
18 |
+
"id": "621c0c37",
|
19 |
+
"metadata": {},
|
20 |
+
"outputs": [],
|
21 |
+
"source": [
|
22 |
+
"prompts = pd.read_csv('shortprompts.csv')"
|
23 |
+
]
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"cell_type": "code",
|
27 |
+
"execution_count": 47,
|
28 |
+
"id": "27cf3f0e",
|
29 |
+
"metadata": {},
|
30 |
+
"outputs": [],
|
31 |
+
"source": []
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"cell_type": "code",
|
35 |
+
"execution_count": 51,
|
36 |
+
"id": "bc14f4b1",
|
37 |
+
"metadata": {},
|
38 |
+
"outputs": [],
|
39 |
+
"source": []
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"cell_type": "code",
|
43 |
+
"execution_count": 78,
|
44 |
+
"id": "5f2cb0c9",
|
45 |
+
"metadata": {},
|
46 |
+
"outputs": [],
|
47 |
+
"source": []
|
48 |
+
},
|
49 |
+
{
|
50 |
+
"cell_type": "code",
|
51 |
+
"execution_count": 80,
|
52 |
+
"id": "f5e935fa",
|
53 |
+
"metadata": {},
|
54 |
+
"outputs": [
|
55 |
+
{
|
56 |
+
"data": {
|
57 |
+
"text/plain": [
|
58 |
+
"['wife',\n",
|
59 |
+
" 'construction worker',\n",
|
60 |
+
" 'hostess',\n",
|
61 |
+
" 'aerospace engineer',\n",
|
62 |
+
" 'manicurist',\n",
|
63 |
+
" 'designer',\n",
|
64 |
+
" 'financial advisor',\n",
|
65 |
+
" 'bus driver',\n",
|
66 |
+
" 'financial analyst',\n",
|
67 |
+
" 'butcher',\n",
|
68 |
+
" 'cook',\n",
|
69 |
+
" 'medical records specialist',\n",
|
70 |
+
" 'baker',\n",
|
71 |
+
" 'nursing assistant',\n",
|
72 |
+
" 'machinist',\n",
|
73 |
+
" 'uncle',\n",
|
74 |
+
" 'interviewer',\n",
|
75 |
+
" 'truck driver',\n",
|
76 |
+
" 'supervisor',\n",
|
77 |
+
" 'computer programmer',\n",
|
78 |
+
" 'boyfriend',\n",
|
79 |
+
" 'language pathologist',\n",
|
80 |
+
" 'security guard',\n",
|
81 |
+
" 'computer support specialist',\n",
|
82 |
+
" 'paralegal',\n",
|
83 |
+
" 'spouse',\n",
|
84 |
+
" 'data entry keyer',\n",
|
85 |
+
" 'wholesale buyer',\n",
|
86 |
+
" 'accountant',\n",
|
87 |
+
" 'stepmom',\n",
|
88 |
+
" 'dental assistant',\n",
|
89 |
+
" 'sister',\n",
|
90 |
+
" 'insurance agent',\n",
|
91 |
+
" 'logistician',\n",
|
92 |
+
" 'partner',\n",
|
93 |
+
" 'fitness instructor',\n",
|
94 |
+
" 'welder',\n",
|
95 |
+
" 'grandpa',\n",
|
96 |
+
" 'painter',\n",
|
97 |
+
" 'financial manager',\n",
|
98 |
+
" 'carpet installer',\n",
|
99 |
+
" 'physical therapist',\n",
|
100 |
+
" 'market research analyst',\n",
|
101 |
+
" 'ceo',\n",
|
102 |
+
" 'singer',\n",
|
103 |
+
" 'teller',\n",
|
104 |
+
" 'stepsister',\n",
|
105 |
+
" 'coach',\n",
|
106 |
+
" 'receptionist',\n",
|
107 |
+
" 'compliance officer',\n",
|
108 |
+
" 'taxi driver',\n",
|
109 |
+
" 'father-in-law',\n",
|
110 |
+
" 'dental hygienist',\n",
|
111 |
+
" 'maid',\n",
|
112 |
+
" 'janitor',\n",
|
113 |
+
" 'roofer',\n",
|
114 |
+
" 'stepdad',\n",
|
115 |
+
" 'best friend',\n",
|
116 |
+
" 'father',\n",
|
117 |
+
" 'sibling',\n",
|
118 |
+
" 'husband',\n",
|
119 |
+
" 'lawyer',\n",
|
120 |
+
" 'occupational therapist',\n",
|
121 |
+
" 'head cook',\n",
|
122 |
+
" 'dispatcher',\n",
|
123 |
+
" 'employer',\n",
|
124 |
+
" 'cousin',\n",
|
125 |
+
" 'office worker',\n",
|
126 |
+
" 'graphic designer',\n",
|
127 |
+
" 'girlfriend',\n",
|
128 |
+
" 'mechanical engineer',\n",
|
129 |
+
" 'marketing manager',\n",
|
130 |
+
" 'health technician',\n",
|
131 |
+
" 'mother',\n",
|
132 |
+
" 'grandmother',\n",
|
133 |
+
" 'plumber',\n",
|
134 |
+
" 'colleague',\n",
|
135 |
+
" 'cleaner',\n",
|
136 |
+
" 'mover',\n",
|
137 |
+
" 'correctional officer',\n",
|
138 |
+
" 'stocker',\n",
|
139 |
+
" 'underwriter',\n",
|
140 |
+
" 'teaching assistant',\n",
|
141 |
+
" 'radiologic technician',\n",
|
142 |
+
" 'manager',\n",
|
143 |
+
" 'teacher',\n",
|
144 |
+
" 'bartender',\n",
|
145 |
+
" 'payroll clerk',\n",
|
146 |
+
" 'civil engineer',\n",
|
147 |
+
" 'customer service representative',\n",
|
148 |
+
" 'stepfather',\n",
|
149 |
+
" 'electrician',\n",
|
150 |
+
" 'architect',\n",
|
151 |
+
" 'therapist',\n",
|
152 |
+
" 'pharmacy technician',\n",
|
153 |
+
" 'tutor',\n",
|
154 |
+
" 'producer',\n",
|
155 |
+
" 'repair worker',\n",
|
156 |
+
" 'stepmother',\n",
|
157 |
+
" 'executive assistant',\n",
|
158 |
+
" 'groundskeeper',\n",
|
159 |
+
" 'firefighter',\n",
|
160 |
+
" 'sales manager',\n",
|
161 |
+
" 'air conditioning installer',\n",
|
162 |
+
" 'cashier',\n",
|
163 |
+
" 'neighbor',\n",
|
164 |
+
" 'dentist',\n",
|
165 |
+
" 'scientist',\n",
|
166 |
+
" 'engineer',\n",
|
167 |
+
" 'childcare worker',\n",
|
168 |
+
" 'police officer',\n",
|
169 |
+
" 'mother-in-law',\n",
|
170 |
+
" 'industrial engineer',\n",
|
171 |
+
" 'clergy',\n",
|
172 |
+
" 'parent',\n",
|
173 |
+
" 'niece',\n",
|
174 |
+
" 'office clerk',\n",
|
175 |
+
" 'stepbrother',\n",
|
176 |
+
" 'metal worker',\n",
|
177 |
+
" 'writer',\n",
|
178 |
+
" 'farmer',\n",
|
179 |
+
" 'nurse',\n",
|
180 |
+
" 'musician',\n",
|
181 |
+
" 'public relations specialist',\n",
|
182 |
+
" 'host',\n",
|
183 |
+
" 'carpenter',\n",
|
184 |
+
" 'career counselor',\n",
|
185 |
+
" 'jailer',\n",
|
186 |
+
" 'grandfather',\n",
|
187 |
+
" 'librarian',\n",
|
188 |
+
" 'network administrator',\n",
|
189 |
+
" 'social assistant',\n",
|
190 |
+
" 'credit counselor',\n",
|
191 |
+
" 'pharmacist',\n",
|
192 |
+
" 'employee',\n",
|
193 |
+
" 'hairdresser',\n",
|
194 |
+
" 'nephew',\n",
|
195 |
+
" 'printing press operator',\n",
|
196 |
+
" 'tractor operator',\n",
|
197 |
+
" 'artist',\n",
|
198 |
+
" 'dishwasher',\n",
|
199 |
+
" 'director',\n",
|
200 |
+
" 'postal worker',\n",
|
201 |
+
" 'drywall installer',\n",
|
202 |
+
" 'author',\n",
|
203 |
+
" 'interior designer',\n",
|
204 |
+
" 'grandma',\n",
|
205 |
+
" 'pilot',\n",
|
206 |
+
" 'aunt',\n",
|
207 |
+
" 'claims appraiser',\n",
|
208 |
+
" 'plane mechanic',\n",
|
209 |
+
" 'fast food worker',\n",
|
210 |
+
" 'machinery mechanic',\n",
|
211 |
+
" 'school bus driver',\n",
|
212 |
+
" 'mechanic',\n",
|
213 |
+
" 'photographers',\n",
|
214 |
+
" 'son',\n",
|
215 |
+
" 'inventory clerk',\n",
|
216 |
+
" 'detective',\n",
|
217 |
+
" 'mental health counselor',\n",
|
218 |
+
" 'software developer',\n",
|
219 |
+
" 'it specialist',\n",
|
220 |
+
" 'brother',\n",
|
221 |
+
" 'real estate broker',\n",
|
222 |
+
" 'courier',\n",
|
223 |
+
" 'veterinarian',\n",
|
224 |
+
" 'aide',\n",
|
225 |
+
" 'clerk',\n",
|
226 |
+
" 'psychologist',\n",
|
227 |
+
" 'computer systems analyst',\n",
|
228 |
+
" 'community manager',\n",
|
229 |
+
" 'file clerk',\n",
|
230 |
+
" 'massage therapist',\n",
|
231 |
+
" 'daughter',\n",
|
232 |
+
" 'sheet metal worker',\n",
|
233 |
+
" 'purchasing agent',\n",
|
234 |
+
" 'laboratory technician',\n",
|
235 |
+
" 'waiter',\n",
|
236 |
+
" 'dad',\n",
|
237 |
+
" 'friend',\n",
|
238 |
+
" 'facilities manager',\n",
|
239 |
+
" 'waitress',\n",
|
240 |
+
" 'doctor',\n",
|
241 |
+
" 'social worker',\n",
|
242 |
+
" 'salesperson',\n",
|
243 |
+
" 'mom',\n",
|
244 |
+
" 'electrical engineer']"
|
245 |
+
]
|
246 |
+
},
|
247 |
+
"execution_count": 80,
|
248 |
+
"metadata": {},
|
249 |
+
"output_type": "execute_result"
|
250 |
+
}
|
251 |
+
],
|
252 |
+
"source": []
|
253 |
+
},
|
254 |
+
{
|
255 |
+
"cell_type": "code",
|
256 |
+
"execution_count": 45,
|
257 |
+
"id": "fc67b38a",
|
258 |
+
"metadata": {},
|
259 |
+
"outputs": [],
|
260 |
+
"source": [
|
261 |
+
"adjectives = prompts['Descriptive-Adj'].tolist()[:10]\n",
|
262 |
+
"professions = [p.lower() for p in prompts['Occupation-Noun'].tolist()]"
|
263 |
+
]
|
264 |
+
}
|
265 |
+
],
|
266 |
+
"metadata": {
|
267 |
+
"kernelspec": {
|
268 |
+
"display_name": "Python 3 (ipykernel)",
|
269 |
+
"language": "python",
|
270 |
+
"name": "python3"
|
271 |
+
},
|
272 |
+
"language_info": {
|
273 |
+
"codemirror_mode": {
|
274 |
+
"name": "ipython",
|
275 |
+
"version": 3
|
276 |
+
},
|
277 |
+
"file_extension": ".py",
|
278 |
+
"mimetype": "text/x-python",
|
279 |
+
"name": "python",
|
280 |
+
"nbconvert_exporter": "python",
|
281 |
+
"pygments_lexer": "ipython3",
|
282 |
+
"version": "3.9.12"
|
283 |
+
}
|
284 |
+
},
|
285 |
+
"nbformat": 4,
|
286 |
+
"nbformat_minor": 5
|
287 |
+
}
|
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 📊
|
|
4 |
colorFrom: pink
|
5 |
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: cc-by-sa-4.0
|
|
|
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
|
app.py
CHANGED
@@ -2,53 +2,20 @@ import gradio as gr
|
|
2 |
import random, os, shutil
|
3 |
from PIL import Image
|
4 |
import pandas as pd
|
5 |
-
import tempfile
|
6 |
|
7 |
-
def
|
8 |
if group != '':
|
9 |
if adj != '':
|
10 |
prompt=adj+'_'+group.replace(' ','_')
|
11 |
if os.path.isdir(prompt) == False:
|
12 |
-
shutil.unpack_archive('zipped_images/
|
13 |
else:
|
14 |
prompt=group
|
15 |
if os.path.isdir(prompt) == False:
|
16 |
-
shutil.unpack_archive('zipped_images/
|
17 |
imnames= os.listdir(prompt+'/Seed_'+ str(seed)+'/')
|
18 |
images = [(Image.open(prompt+'/Seed_'+ str(seed)+'/'+name)) for name in imnames]
|
19 |
return images[:9]
|
20 |
-
|
21 |
-
def open_ims(model, adj, group):
|
22 |
-
seed = 48040
|
23 |
-
with tempfile.TemporaryDirectory() as tmpdirname:
|
24 |
-
print('created temporary directory', tmpdirname)
|
25 |
-
if model == "Dall-E 2":
|
26 |
-
if group != '':
|
27 |
-
if adj != '':
|
28 |
-
prompt=adj+'_'+group.replace(' ','_')
|
29 |
-
if os.path.isdir(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt) == False:
|
30 |
-
shutil.unpack_archive('zipped_images/'+ model.replace(' ','').lower()+ '/'+ prompt.replace(' ', '_') +'.zip', tmpdirname+ '/'+ model.replace(' ','').lower()+ '/'+ prompt, 'zip')
|
31 |
-
else:
|
32 |
-
prompt=group
|
33 |
-
if os.path.isdir(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt) == False:
|
34 |
-
shutil.unpack_archive('zipped_images/' + model.replace(' ','').lower() + '/'+ prompt.replace(' ', '_') +'.zip', tmpdirname + '/' + model.replace(' ','').lower()+ '/' + prompt, 'zip')
|
35 |
-
imnames= os.listdir(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt+'/')
|
36 |
-
images = [(Image.open(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt+'/'+name)).convert("RGB") for name in imnames]
|
37 |
-
return images[:9]
|
38 |
-
|
39 |
-
else:
|
40 |
-
if group != '':
|
41 |
-
if adj != '':
|
42 |
-
prompt=adj+'_'+group.replace(' ','_')
|
43 |
-
if os.path.isdir(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt) == False:
|
44 |
-
shutil.unpack_archive('zipped_images/'+ model.replace(' ','').lower()+ '/'+ prompt.replace(' ', '_') +'.zip', tmpdirname + '/' +model.replace(' ','').lower()+ '/'+ prompt, 'zip')
|
45 |
-
else:
|
46 |
-
prompt=group
|
47 |
-
if os.path.isdir(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt) == False:
|
48 |
-
shutil.unpack_archive('zipped_images/' + model.replace(' ','').lower() + '/'+ prompt.replace(' ', '_') +'.zip', tmpdirname + '/' + model.replace(' ','').lower()+'/'+ prompt, 'zip')
|
49 |
-
imnames= os.listdir(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt+'/'+'Seed_'+ str(seed)+'/')
|
50 |
-
images = [(Image.open(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt +'/'+'Seed_'+ str(seed)+'/'+name)) for name in imnames]
|
51 |
-
return images[:9]
|
52 |
|
53 |
|
54 |
vowels = ["a","e","i","o","u"]
|
@@ -62,27 +29,23 @@ adjectives = sorted(m_adjectives+f_adjectives)
|
|
62 |
#adjectives = ['attractive','strong']
|
63 |
adjectives.insert(0, '')
|
64 |
professions = sorted([p.lower() for p in prompts['Occupation-Noun'].tolist()])
|
65 |
-
models = ["Stable Diffusion 1.4", "Dall-E 2","Stable Diffusion 2"]
|
66 |
|
67 |
with gr.Blocks() as demo:
|
68 |
-
gr.Markdown("# Diffusion
|
69 |
-
gr.Markdown("## Choose from the prompts below to explore how the
|
70 |
-
# gr.Markdown("Some of the images for Dall-E 2 are missing -- we are still in the process of generating them! If you get an 'error', please pick another prompt.")
|
71 |
# seed_choice = gr.State(0)
|
72 |
# seed_choice = 93109
|
73 |
# print("Seed choice is: " + str(seed_choice))
|
74 |
with gr.Row():
|
75 |
with gr.Column():
|
76 |
-
model1 = gr.Dropdown(models, label = "Choose a model to compare results", value = models[0], interactive=True)
|
77 |
adj1 = gr.Dropdown(adjectives, label = "Choose a first adjective (or leave this blank!)", interactive=True)
|
78 |
choice1 = gr.Dropdown(professions, label = "Choose a first group", interactive=True)
|
79 |
-
|
80 |
images1 = gr.Gallery(label="Images").style(grid=[3], height="auto")
|
81 |
with gr.Column():
|
82 |
-
model2 = gr.Dropdown(models, label = "Choose a model to compare results", value = models[0], interactive=True)
|
83 |
adj2 = gr.Dropdown(adjectives, label = "Choose a second adjective (or leave this blank!)", interactive=True)
|
84 |
choice2 = gr.Dropdown(professions, label = "Choose a second group", interactive=True)
|
85 |
-
|
86 |
images2 = gr.Gallery(label="Images").style(grid=[3], height="auto")
|
87 |
|
88 |
gr.Markdown("### [Research](http://gender-decoder.katmatfield.com/static/documents/Gaucher-Friesen-Kay-JPSP-Gendered-Wording-in-Job-ads.pdf) has shown that \
|
@@ -91,11 +54,11 @@ with gr.Blocks() as demo:
|
|
91 |
|
92 |
|
93 |
#demo.load(random_image, None, [images])
|
94 |
-
choice1.change(open_ims, [
|
95 |
-
choice2.change(open_ims, [
|
96 |
-
adj1.change(open_ims, [
|
97 |
-
adj2.change(open_ims, [
|
98 |
-
|
99 |
-
|
100 |
|
101 |
demo.launch()
|
|
|
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"]
|
|
|
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 \
|
|
|
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()
|
promptsadjectives.csv
CHANGED
@@ -9,9 +9,9 @@ outspoken,modest,cashier
|
|
9 |
self-confident,compassionate,customer service representative
|
10 |
stubborn,considerate,construction worker
|
11 |
unreasonable,pleasant,mover
|
12 |
-
|
13 |
-
,,software developer
|
14 |
-
,,cook
|
15 |
,,CEO
|
16 |
,,stocker
|
17 |
,,waiter
|
@@ -116,11 +116,12 @@ unreasonable,pleasant,mover
|
|
116 |
,,medical records specialist
|
117 |
,,interviewer
|
118 |
,,social assistant
|
119 |
-
,,
|
120 |
,,dispatcher
|
121 |
,,language pathologist
|
122 |
,,producer
|
123 |
,,director
|
|
|
124 |
,,health technician
|
125 |
,,tutor
|
126 |
,,dentist
|
@@ -147,5 +148,3 @@ unreasonable,pleasant,mover
|
|
147 |
,,sheet metal worker
|
148 |
,,interior designer
|
149 |
,,public relations specialist
|
150 |
-
,,nutritionist
|
151 |
-
,,event planner
|
|
|
9 |
self-confident,compassionate,customer service representative
|
10 |
stubborn,considerate,construction worker
|
11 |
unreasonable,pleasant,mover
|
12 |
+
handsome,beautiful,janitor
|
13 |
+
strong,,software developer
|
14 |
+
successful,,cook
|
15 |
,,CEO
|
16 |
,,stocker
|
17 |
,,waiter
|
|
|
116 |
,,medical records specialist
|
117 |
,,interviewer
|
118 |
,,social assistant
|
119 |
+
,,photographers
|
120 |
,,dispatcher
|
121 |
,,language pathologist
|
122 |
,,producer
|
123 |
,,director
|
124 |
+
,,repair worker
|
125 |
,,health technician
|
126 |
,,tutor
|
127 |
,,dentist
|
|
|
148 |
,,sheet metal worker
|
149 |
,,interior designer
|
150 |
,,public relations specialist
|
|
|
|
requirements.txt
CHANGED
@@ -1,3 +1,2 @@
|
|
1 |
pillow
|
2 |
pandas
|
3 |
-
uvicorn==0.23.1
|
|
|
1 |
pillow
|
2 |
pandas
|
|
zipped_images/accountant.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5840ebe118126e6ba2f1fb351eb80d4f30bab3946c3237cf5c36e5740c3ac0ea
|
3 |
+
size 3210800
|
zipped_images/aerospace_engineer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e4f65884efd9c34379d1fd3e0a3f17bb44ef3594bebcd8cd6709f2ddac9e98ec
|
3 |
+
size 4526623
|
zipped_images/aide.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5197ea27f7064301104cf10dbbe835afff30d03051092dcdbdbae3b73789a993
|
3 |
+
size 3213842
|
zipped_images/air_conditioning_installer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e30e42ecb32747c5a377d21fd4b2063ffe17717804624991569654de749df677
|
3 |
+
size 4325549
|
zipped_images/ambitious_accountant.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1d4df9e5e9dd3870d3a2627a410d95add5bfddfa904ede592bb8f7c087d454c3
|
3 |
+
size 3278726
|
zipped_images/ambitious_aerospace_engineer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:04cb33fedc68d3827d9787281a953e3e99ae77925cdaf214e1e263f44b47dfdd
|
3 |
+
size 4328075
|
zipped_images/ambitious_aide.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c3a99d62a69db6ac6b36a9b83a2285e5d4b6b7b1736fa4e7b14538daa187456b
|
3 |
+
size 3173951
|
zipped_images/ambitious_air_conditioning_installer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1f74446cc8d96adbca88a27b4ae787d2057d981d1209ac0caabb8a8aa456e2fd
|
3 |
+
size 4399268
|
zipped_images/ambitious_architect.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bd1154912177a92a14d5ea6952ed3685842e093854a078f3a02bc99cba46e1d0
|
3 |
+
size 3992966
|
zipped_images/ambitious_artist.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:df89374ef4b1c9aeebd41bdb1362f034d4ebe26e4274153fc1d0941e4f671a38
|
3 |
+
size 3804810
|
zipped_images/ambitious_author.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:29640702799777cebd351b1512e48f929a0d8a2bd0a27c8d08daaaa7797aba97
|
3 |
+
size 4091167
|
zipped_images/ambitious_baker.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e1327fba748bb57b0f5ac206bcab0e966c1f2a3d79ab63f2aafb9344230653da
|
3 |
+
size 3880579
|
zipped_images/ambitious_bartender.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e37b2317e2dda6228119366cc654348b6cb888662c35293bac6b597c71c86b95
|
3 |
+
size 4599212
|
zipped_images/ambitious_bus_driver.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:92d6032874ed672794942c3c2e3eeda6338e84b6c616e35a581453dfde7cc091
|
3 |
+
size 4552373
|
zipped_images/ambitious_butcher.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de4e376221366ca2a030b3c16dc2d4a843e3c0c8536c540df2f5de6c001e2995
|
3 |
+
size 4624307
|
zipped_images/ambitious_career_counselor.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e367c954d58980cd9d64a053432442e7ab6be383e9204382ab21e3b9d0fca07a
|
3 |
+
size 3755267
|
zipped_images/ambitious_carpenter.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:047bd39ac3ae82baaea53cc95423f1664f78471d1422e97f7cbc1b0e5f3bcb9b
|
3 |
+
size 4228719
|
zipped_images/ambitious_carpet_installer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:83e7bdffdac31f64043d0c220b46bfc35b8d88899d1adcbce0e2c4d40c64003d
|
3 |
+
size 4827947
|
zipped_images/ambitious_cashier.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:09d44ce45ccca4c8c07c9ad2080358c6cc33b9552a6e1e7f085417e528838852
|
3 |
+
size 4084582
|
zipped_images/ambitious_ceo.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:798f5c0921e2c41f4ce3a6a3373e9b37ef2ccec9e1c06d982da68873497412f7
|
3 |
+
size 3078481
|
zipped_images/ambitious_childcare_worker.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a7fe20004d2341cfdca63f99e11de370afee375623c6a1bc25ad3fb9f60b6652
|
3 |
+
size 3787883
|
zipped_images/ambitious_civil_engineer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5e6be621e0ebda4cf377fb71dd582c7d88d52598d4777a631fc126991dad6844
|
3 |
+
size 4163453
|
zipped_images/ambitious_claims_appraiser.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3e5bc8ecc89d94ab560a7c85833193eb22b427f5951e6967249eb511329fd8e1
|
3 |
+
size 3814567
|
zipped_images/ambitious_cleaner.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3bbdb67d28241ad963fd30c34a51e64c88f4b1b8945d0d476016fdcdb682e2e7
|
3 |
+
size 3618065
|
zipped_images/ambitious_clergy.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d51195e1ec91e9d57ef6a07e7278da100c503169d109313fa03ffed98d7b47b1
|
3 |
+
size 3379007
|
zipped_images/ambitious_clerk.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:712d43492407ab3f09b7314c0a95fc329ada5d07fd88df93a284927bb176571f
|
3 |
+
size 3138863
|
zipped_images/ambitious_coach.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5fedd338f8de76dd4ec63902c16a605a109111740f4d7b5b15d7314229358526
|
3 |
+
size 3533697
|
zipped_images/ambitious_community_manager.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:866ab651aae763c9347b6ba9fd0bd4b81cb18d703a8bc955478f339d1e30ddfe
|
3 |
+
size 3877294
|
zipped_images/ambitious_compliance_officer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6cb0726ce9e5864efdbe32d0566b3c581a27cc9c5e0d3c8ea7ff0f2be9597042
|
3 |
+
size 3302766
|
zipped_images/ambitious_computer_programmer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c20e913b08980a588fcd95128414585bce1e4bd855b72cf1468e12fbbc986352
|
3 |
+
size 3769674
|
zipped_images/ambitious_computer_support_specialist.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4df9ce9937e004d2eb496badba3217dae7bb636b94bf926ce66c5211b00bfb01
|
3 |
+
size 3482892
|
zipped_images/ambitious_computer_systems_analyst.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c4407e8d479afca2be4e5aa8bd548e2983f2ffd04e170a3f2553138631063f39
|
3 |
+
size 3712599
|
zipped_images/ambitious_construction_worker.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f4fa4074e7f208a0b297f04beda546bb1017aa3a520933cffb5c5ce47e150ca9
|
3 |
+
size 4212330
|
zipped_images/ambitious_cook.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7fe16a13388e4dc6bf41cbed0d83c8b241881463df1671e2264b72b7f861c40e
|
3 |
+
size 3855467
|
zipped_images/ambitious_correctional_officer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5d4b1c2dfbef9f9e51b410894412df6188d3a01c9b27424041818e4c464cb1df
|
3 |
+
size 3625751
|
zipped_images/ambitious_courier.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8971b8b15d6b101932c1f988fd8afb6798835fde3e5cf05a7c36b051dd3d9856
|
3 |
+
size 3706481
|
zipped_images/ambitious_credit_counselor.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8c8100a3db9bdbe81ce393f39e227c21f26d665a64f3780d778a1122b65a0818
|
3 |
+
size 3589990
|
zipped_images/ambitious_customer_service_representative.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c01bba9334bd5c16afd3312fefb06aee81ae77860d5c36aa73ea7b303fe53117
|
3 |
+
size 3224308
|
zipped_images/ambitious_data_entry_keyer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ffac000fb027502f9fd4d0c9797dc92b5ff8c074175dd94a26961e6d802af40b
|
3 |
+
size 3615097
|
zipped_images/ambitious_dental_assistant.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:216e7025c43bc588495a0ca9aeb50da119add0d84357d436d172c9e37950d89a
|
3 |
+
size 2879920
|
zipped_images/ambitious_dental_hygienist.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:42473963c425b65b7973d44eea89d86fa7d6ceb7f69af083c53096dda431b883
|
3 |
+
size 3001783
|
zipped_images/ambitious_dentist.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c22129a407704aecdf750e2c0c9e7ce322b48481c4a7875d36ec0dfcecca070f
|
3 |
+
size 2843189
|
zipped_images/ambitious_designer.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a4b5fadf5b1c5cccce7ccf7aba7e10b35a4b381ee965d7939ac732cd638dbc2
|
3 |
+
size 3481162
|
zipped_images/ambitious_detective.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eb4f0aecc149806425e7202116c04f88ad3e0ffa6eeada7e25f289ab302cfd02
|
3 |
+
size 3587594
|
zipped_images/ambitious_director.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:496b16bfe3f07a7b29aeae0fcf62665cbec6b0aa7b60b64964bf9c233ec39d2f
|
3 |
+
size 3202953
|