Spaces:
Runtime error
Runtime error
fixing
Browse files
app.py
CHANGED
@@ -154,8 +154,8 @@ def combine_components_slice(model, gd, im1, im2, indices=None, sample_method='d
|
|
154 |
def decompose_image_demo(im, model):
|
155 |
sample_method = 'ddim'
|
156 |
result = gen_image_and_components(MODELS[model], GD[sample_method], im, sample_method=sample_method, num_images=1, device=device)
|
157 |
-
result = Image.fromarray(result.permute(1, 2, 0).numpy())
|
158 |
-
return result
|
159 |
|
160 |
|
161 |
def combine_images_demo(im1, im2, model):
|
@@ -164,6 +164,7 @@ def combine_images_demo(im1, im2, model):
|
|
164 |
result = Image.fromarray(result.permute(1, 2, 0).numpy())
|
165 |
if model == 'CelebA-HQ':
|
166 |
return upscale_image(result, pipe)
|
|
|
167 |
|
168 |
|
169 |
def load_model(dataset, extra_kwargs={}, device='cuda'):
|
@@ -226,7 +227,7 @@ with gr.Blocks() as demo:
|
|
226 |
)
|
227 |
|
228 |
with gr.Column():
|
229 |
-
decomp_output = gr.Image(type='
|
230 |
decomp_button = gr.Button("Generate")
|
231 |
|
232 |
|
@@ -270,4 +271,4 @@ with gr.Blocks() as demo:
|
|
270 |
outputs=comb_output)
|
271 |
|
272 |
|
273 |
-
demo.launch()
|
|
|
154 |
def decompose_image_demo(im, model):
|
155 |
sample_method = 'ddim'
|
156 |
result = gen_image_and_components(MODELS[model], GD[sample_method], im, sample_method=sample_method, num_images=1, device=device)
|
157 |
+
# result = Image.fromarray(result.permute(1, 2, 0).numpy())
|
158 |
+
return result.permute(1, 2, 0).numpy()
|
159 |
|
160 |
|
161 |
def combine_images_demo(im1, im2, model):
|
|
|
164 |
result = Image.fromarray(result.permute(1, 2, 0).numpy())
|
165 |
if model == 'CelebA-HQ':
|
166 |
return upscale_image(result, pipe)
|
167 |
+
return result
|
168 |
|
169 |
|
170 |
def load_model(dataset, extra_kwargs={}, device='cuda'):
|
|
|
227 |
)
|
228 |
|
229 |
with gr.Column():
|
230 |
+
decomp_output = gr.Image(type='numpy')
|
231 |
decomp_button = gr.Button("Generate")
|
232 |
|
233 |
|
|
|
271 |
outputs=comb_output)
|
272 |
|
273 |
|
274 |
+
demo.launch(debug=True)
|