Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse filesMaking memory work
app.py
CHANGED
@@ -28,11 +28,11 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, re
|
|
28 |
torch.cuda.empty_cache()
|
29 |
|
30 |
if upscale == "Yes":
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
torch.cuda.empty_cache()
|
35 |
-
upscaled =
|
36 |
torch.cuda.empty_cache()
|
37 |
return upscaled
|
38 |
else:
|
|
|
28 |
torch.cuda.empty_cache()
|
29 |
|
30 |
if upscale == "Yes":
|
31 |
+
refiner = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True)
|
32 |
+
refiner.enable_xformers_memory_efficient_attention()
|
33 |
+
refiner = upscaler.to(device)
|
34 |
torch.cuda.empty_cache()
|
35 |
+
upscaled = refiner(prompt=Prompt, negative_prompt=negative_prompt, image=image, num_inference_steps=15, guidance_scale=0).images[0]
|
36 |
torch.cuda.empty_cache()
|
37 |
return upscaled
|
38 |
else:
|