Update app.py
Browse files
app.py
CHANGED
@@ -33,18 +33,16 @@ else:
|
|
33 |
refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True)
|
34 |
refiner = refiner.to(device)
|
35 |
|
36 |
-
def genie (prompt, negative_prompt, height, width, scale, steps, seed,
|
37 |
generator = torch.Generator(device=device).manual_seed(seed)
|
38 |
int_image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=steps, height=height, width=width, guidance_scale=scale, num_images_per_prompt=1, generator=generator, output_type="latent").images
|
39 |
-
|
40 |
-
if upscaler == 'Yes':
|
41 |
image = refiner(prompt=prompt, image=int_image).images[0]
|
42 |
-
torch.cuda.empty_cache()
|
43 |
upscaled = upscaler(prompt=prompt, negative_prompt=negative_prompt, image=image, num_inference_steps=5, guidance_scale=0).images[0]
|
44 |
torch.cuda.empty_cache()
|
45 |
return (image, upscaled)
|
46 |
else:
|
47 |
-
image = refiner(prompt=prompt, negative_prompt=negative_prompt, image=int_image).images[0]
|
48 |
torch.cuda.empty_cache()
|
49 |
return (image, image)
|
50 |
|
|
|
33 |
refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True)
|
34 |
refiner = refiner.to(device)
|
35 |
|
36 |
+
def genie (prompt, negative_prompt, height, width, scale, steps, seed, upscaling):
|
37 |
generator = torch.Generator(device=device).manual_seed(seed)
|
38 |
int_image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=steps, height=height, width=width, guidance_scale=scale, num_images_per_prompt=1, generator=generator, output_type="latent").images
|
39 |
+
if upscaling == 'Yes':
|
|
|
40 |
image = refiner(prompt=prompt, image=int_image).images[0]
|
|
|
41 |
upscaled = upscaler(prompt=prompt, negative_prompt=negative_prompt, image=image, num_inference_steps=5, guidance_scale=0).images[0]
|
42 |
torch.cuda.empty_cache()
|
43 |
return (image, upscaled)
|
44 |
else:
|
45 |
+
image = refiner(prompt=prompt, negative_prompt=negative_prompt, image=int_image).images[0]
|
46 |
torch.cuda.empty_cache()
|
47 |
return (image, image)
|
48 |
|