Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -28,15 +28,15 @@ 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 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
else:
|
41 |
image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
42 |
torch.cuda.empty_cache()
|
|
|
28 |
torch.cuda.empty_cache()
|
29 |
|
30 |
if upscale == "Yes":
|
31 |
+
upscaler = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True)
|
32 |
+
upscaler.enable_xformers_memory_efficient_attention()
|
33 |
+
upscaler = upscaler.to(device)
|
34 |
+
torch.cuda.empty_cache()
|
35 |
+
upscaled = upscaler(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:
|
39 |
+
return image
|
40 |
else:
|
41 |
image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
|
42 |
torch.cuda.empty_cache()
|