solitarycodefinement commited on
Commit
39b230a
·
1 Parent(s): d576e2f

christmas models

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -158,7 +158,7 @@ class ImageEditor(object):
158
  def get_target_latent(self, source_latent, alter, generators):
159
  np_source_latent = source_latent.squeeze(0).cpu().detach().numpy()
160
  if alter == "None":
161
- return source_latent.squeeze(0) * max((len(generators) - 1), 1)
162
  edit = interface_gan_map[alter]
163
  projected_code_np = project_code_by_edit_name(np_source_latent, edit[0], edit[1])
164
  return torch.from_numpy(projected_code_np).float().to(self.device)
@@ -230,10 +230,10 @@ with blocks:
230
 
231
  with gr.Column():
232
  style_choice = gr.inputs.CheckboxGroup(choices=editor.get_style_list(), type="value",
233
- label="Choose your styles!")
234
  alter = gr.Dropdown(
235
  choices=["None", "Masculine", "Feminine", "Smiling", "Frowning", "Young", "Old", "Short Hair",
236
- "Long Hair"], value="None")
237
  img_button = gr.Button("Edit Image")
238
 
239
  with gr.Row():
 
158
  def get_target_latent(self, source_latent, alter, generators):
159
  np_source_latent = source_latent.squeeze(0).cpu().detach().numpy()
160
  if alter == "None":
161
+ return random.choice([source_latent.squeeze(0),] * max((len(generators) - 1), 1))
162
  edit = interface_gan_map[alter]
163
  projected_code_np = project_code_by_edit_name(np_source_latent, edit[0], edit[1])
164
  return torch.from_numpy(projected_code_np).float().to(self.device)
 
230
 
231
  with gr.Column():
232
  style_choice = gr.inputs.CheckboxGroup(choices=editor.get_style_list(), type="value",
233
+ label="Styles")
234
  alter = gr.Dropdown(
235
  choices=["None", "Masculine", "Feminine", "Smiling", "Frowning", "Young", "Old", "Short Hair",
236
+ "Long Hair"], value="None", label="Additional Modifiers")
237
  img_button = gr.Button("Edit Image")
238
 
239
  with gr.Row():