Spaces:
Runtime error
Runtime error
Мясников Филипп Сергеевич
commited on
Commit
•
a10e5ed
1
Parent(s):
cc5a389
Fix
Browse files
app.py
CHANGED
@@ -112,7 +112,7 @@ def run_alignment(image_path):
|
|
112 |
return aligned_image
|
113 |
|
114 |
|
115 |
-
def gen_im(model_type='ffhq'):
|
116 |
if model_type=='ffhq':
|
117 |
imgs, _ = ffhq_decoder([ffhq_codes], input_is_latent=True, randomize_noise=False, return_latents=True)
|
118 |
elif model_type=='dog':
|
@@ -140,7 +140,7 @@ def inference(img):
|
|
140 |
dog_codes = dog_codes + ffhq_latent_avg.repeat(dog_codes.shape[0], 1, 1)
|
141 |
|
142 |
animal = "cat"
|
143 |
-
npimage = gen_im(animal)
|
144 |
|
145 |
imageio.imwrite('filename.jpeg', npimage)
|
146 |
return 'filename.jpeg'
|
|
|
112 |
return aligned_image
|
113 |
|
114 |
|
115 |
+
def gen_im(ffhq_codes, dog_codes, cat_codes, model_type='ffhq'):
|
116 |
if model_type=='ffhq':
|
117 |
imgs, _ = ffhq_decoder([ffhq_codes], input_is_latent=True, randomize_noise=False, return_latents=True)
|
118 |
elif model_type=='dog':
|
|
|
140 |
dog_codes = dog_codes + ffhq_latent_avg.repeat(dog_codes.shape[0], 1, 1)
|
141 |
|
142 |
animal = "cat"
|
143 |
+
npimage = gen_im(ffhq_codes, dog_codes, cat_codes, animal)
|
144 |
|
145 |
imageio.imwrite('filename.jpeg', npimage)
|
146 |
return 'filename.jpeg'
|