Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -259,7 +259,7 @@ def reconstruct(input_img: Image.Image, caption: str):
|
|
259 |
image = pipe.vae.decode(
|
260 |
latents / pipe.vae.config.scaling_factor, return_dict=False
|
261 |
)[0]
|
262 |
-
img_np = image.squeeze(0).float().permute(1, 2, 0).cpu()
|
263 |
img_np = ((img_np / 2 + 0.5).clamp(0, 1).numpy() * 255).astype(np.uint8)
|
264 |
|
265 |
update_scale(12) # initial cross-attn value
|
@@ -303,7 +303,7 @@ def apply_prompt(meta_data: Any, new_prompt: str):
|
|
303 |
latents.unsqueeze(0) / pipe.vae.config.scaling_factor,
|
304 |
return_dict=False
|
305 |
)[0]
|
306 |
-
img_np = image.squeeze(0).float().permute(1, 2, 0).cpu()
|
307 |
img_np = ((img_np / 2 + 0.5).clamp(0, 1).numpy() * 255).astype(np.uint8)
|
308 |
|
309 |
pipe.to("cpu"); torch.cuda.empty_cache()
|
|
|
259 |
image = pipe.vae.decode(
|
260 |
latents / pipe.vae.config.scaling_factor, return_dict=False
|
261 |
)[0]
|
262 |
+
img_np = image.squeeze(0).float().permute(1, 2, 0).detach().cpu()
|
263 |
img_np = ((img_np / 2 + 0.5).clamp(0, 1).numpy() * 255).astype(np.uint8)
|
264 |
|
265 |
update_scale(12) # initial cross-attn value
|
|
|
303 |
latents.unsqueeze(0) / pipe.vae.config.scaling_factor,
|
304 |
return_dict=False
|
305 |
)[0]
|
306 |
+
img_np = image.squeeze(0).float().permute(1, 2, 0).detach().cpu()
|
307 |
img_np = ((img_np / 2 + 0.5).clamp(0, 1).numpy() * 255).astype(np.uint8)
|
308 |
|
309 |
pipe.to("cpu"); torch.cuda.empty_cache()
|