Мясников Филипп Сергеевич commited on
Commit
f991108
1 Parent(s): 8c42239
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -114,17 +114,17 @@ def inference(img):
114
  img.save('out.jpg')
115
  aligned_face = align_face('out.jpg')
116
 
117
- ffhq_codes = ffhq_encoder(aligned_face.unsqueeze(0).to("cuda").float())
118
- ffhq_codes = ffhq_codes + ffhq_latent_avg.repeat(ffhq_codes.shape[0], 1, 1)
119
 
120
- cat_codes = cat_encoder(aligned_face.unsqueeze(0).to("cuda").float())
121
- cat_codes = cat_codes + ffhq_latent_avg.repeat(cat_codes.shape[0], 1, 1)
122
 
123
- dog_codes = dog_encoder(aligned_face.unsqueeze(0).to("cuda").float())
124
- dog_codes = dog_codes + ffhq_latent_avg.repeat(dog_codes.shape[0], 1, 1)
125
 
126
  animal = "cat"
127
- npimage = gen_im(animal)
128
 
129
  imageio.imwrite('filename.jpeg', npimage)
130
  return 'filename.jpeg'
 
114
  img.save('out.jpg')
115
  aligned_face = align_face('out.jpg')
116
 
117
+ ffhq_codes = ffhq_encoder(aligned_face.unsqueeze(0).to("cuda").float())
118
+ ffhq_codes = ffhq_codes + ffhq_latent_avg.repeat(ffhq_codes.shape[0], 1, 1)
119
 
120
+ cat_codes = cat_encoder(aligned_face.unsqueeze(0).to("cuda").float())
121
+ cat_codes = cat_codes + ffhq_latent_avg.repeat(cat_codes.shape[0], 1, 1)
122
 
123
+ dog_codes = dog_encoder(aligned_face.unsqueeze(0).to("cuda").float())
124
+ dog_codes = dog_codes + ffhq_latent_avg.repeat(dog_codes.shape[0], 1, 1)
125
 
126
  animal = "cat"
127
+ npimage = gen_im(animal)
128
 
129
  imageio.imwrite('filename.jpeg', npimage)
130
  return 'filename.jpeg'