ironjr commited on
Commit
a166563
β€’
1 Parent(s): 8dcc60e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -167,19 +167,19 @@ example_images = [Image.open(i) for i in example_images]
167
  with open(os.path.join(example_root, 'prompt_background.txt')) as f:
168
  prompts_background = [l.strip() for l in f.readlines() if l.strip() != '']
169
 
170
- # with open(os.path.join(example_root, 'prompt_girl.txt')) as f:
171
- # prompts_girl = [l.strip() for l in f.readlines() if l.strip() != '']
172
 
173
- # with open(os.path.join(example_root, 'prompt_boy.txt')) as f:
174
- # prompts_boy = [l.strip() for l in f.readlines() if l.strip() != '']
175
 
176
  with open(os.path.join(example_root, 'prompt_props.txt')) as f:
177
  prompts_props = [l.strip() for l in f.readlines() if l.strip() != '']
178
  prompts_props = {l.split(',')[0].strip(): ','.join(l.split(',')[1:]).strip() for l in prompts_props}
179
 
180
  prompt_background = lambda: random.choice(prompts_background)
181
- # prompt_girl = lambda: random.choice(prompts_girl)
182
- # prompt_boy = lambda: random.choice(prompts_boy)
183
  prompt_props = lambda: np.random.choice(list(prompts_props.keys()), size=(opt.max_palettes - 1), replace=False).tolist()
184
 
185
 
@@ -243,11 +243,14 @@ def select_palette(state, button, idx):
243
 
244
 
245
  def random_palette(state):
246
- girlboy = random.choice(['A girl smiling at viewer', 'A boy smiling at viewer'])
247
- girlboy_name = 'πŸ‘§ Girl' if 'girl' in girlboy else 'πŸ‘¦ Boy'
 
 
 
248
  prompt_props_ = prompt_props()
249
  state.prompt_names = ['πŸŒ„ Background'] + [girlboy_name] + prompt_props_
250
- state.prompts = [''] + [girlboy] + [prompts_props[k] for k in prompt_props_]
251
  state.neg_prompts = [
252
  opt.default_negative_prompt
253
  + (', humans, humans, humans' if i == 0 else '')
 
167
  with open(os.path.join(example_root, 'prompt_background.txt')) as f:
168
  prompts_background = [l.strip() for l in f.readlines() if l.strip() != '']
169
 
170
+ with open(os.path.join(example_root, 'prompt_girl.txt')) as f:
171
+ prompts_girl = [l.strip() for l in f.readlines() if l.strip() != '']
172
 
173
+ with open(os.path.join(example_root, 'prompt_boy.txt')) as f:
174
+ prompts_boy = [l.strip() for l in f.readlines() if l.strip() != '']
175
 
176
  with open(os.path.join(example_root, 'prompt_props.txt')) as f:
177
  prompts_props = [l.strip() for l in f.readlines() if l.strip() != '']
178
  prompts_props = {l.split(',')[0].strip(): ','.join(l.split(',')[1:]).strip() for l in prompts_props}
179
 
180
  prompt_background = lambda: random.choice(prompts_background)
181
+ prompt_girl = lambda: random.choice(prompts_girl)
182
+ prompt_boy = lambda: random.choice(prompts_boy)
183
  prompt_props = lambda: np.random.choice(list(prompts_props.keys()), size=(opt.max_palettes - 1), replace=False).tolist()
184
 
185
 
 
243
 
244
 
245
  def random_palette(state):
246
+ # girlboy = random.choice(['A girl smiling at viewer', 'A boy smiling at viewer'])
247
+ girlboy = random.choice(['girl', 'boy'])
248
+ girlboy_name = 'πŸ‘§ Girl' if girlboy == 'girl' else 'πŸ‘¦ Boy'
249
+ girlboy_prompt = prompt_girl() if girlboy == 'girl' else prompt_boy()
250
+
251
  prompt_props_ = prompt_props()
252
  state.prompt_names = ['πŸŒ„ Background'] + [girlboy_name] + prompt_props_
253
+ state.prompts = [''] + [girlboy_prompt] + [prompts_props[k] for k in prompt_props_]
254
  state.neg_prompts = [
255
  opt.default_negative_prompt
256
  + (', humans, humans, humans' if i == 0 else '')