meg-huggingface commited on
Commit
f0b9fcf
·
1 Parent(s): 64a0385

Fixing gr.Gallery style error -- no longer supported as such.

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -37,11 +37,14 @@ def open_ims(model, adj, group):
37
  return images[:9]
38
 
39
  else:
40
- if group != '':
41
- if adj != '':
 
 
42
  prompt=adj+'_'+str(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:
@@ -77,13 +80,13 @@ with gr.Blocks() as demo:
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
  # seed1= gr.Dropdown(seeds, label = "Choose a random seed to compare results", value = seeds[1], interactive=True)
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
  # seed2= gr.Dropdown(seeds, label = "Choose a random seed to compare results", value= seeds[1], interactive=True)
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 \
89
  certain words are considered more masculine- or feminine-coded based on how appealing job descriptions containing these words \
 
37
  return images[:9]
38
 
39
  else:
40
+ # Once a subgroup as been selected....
41
+ if group not in ('', None, []):
42
+ # If an adjective is selected, generate the adj + subgroup.
43
+ if adj not in ('', None, []):
44
  prompt=adj+'_'+str(group).replace(' ','_')
45
  if os.path.isdir(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt) == False:
46
  shutil.unpack_archive('zipped_images/'+ model.replace(' ','').lower()+ '/'+ prompt.replace(' ', '_') +'.zip', tmpdirname + '/' +model.replace(' ','').lower()+ '/'+ prompt, 'zip')
47
+ # Otherwise, just the subgroup.
48
  else:
49
  prompt=group
50
  if os.path.isdir(tmpdirname + '/' + model.replace(' ','').lower()+ '/'+ prompt) == False:
 
80
  adj1 = gr.Dropdown(adjectives, label = "Choose a first adjective (or leave this blank!)", interactive=True)
81
  choice1 = gr.Dropdown(professions, label = "Choose a first group", interactive=True)
82
  # seed1= gr.Dropdown(seeds, label = "Choose a random seed to compare results", value = seeds[1], interactive=True)
83
+ images1 = gr.Gallery(label="Images") #.style(grid=[3], height="auto")
84
  with gr.Column():
85
  model2 = gr.Dropdown(models, label = "Choose a model to compare results", value = models[0], interactive=True)
86
  adj2 = gr.Dropdown(adjectives, label = "Choose a second adjective (or leave this blank!)", interactive=True)
87
  choice2 = gr.Dropdown(professions, label = "Choose a second group", interactive=True)
88
  # seed2= gr.Dropdown(seeds, label = "Choose a random seed to compare results", value= seeds[1], interactive=True)
89
+ images2 = gr.Gallery(label="Images")#.style(grid=[3], height="auto")
90
 
91
  gr.Markdown("### [Research](http://gender-decoder.katmatfield.com/static/documents/Gaucher-Friesen-Kay-JPSP-Gendered-Wording-in-Job-ads.pdf) has shown that \
92
  certain words are considered more masculine- or feminine-coded based on how appealing job descriptions containing these words \