Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse filesRemoved unneeded and experimental settings. Now passing Prompt and Negative Prompt directly to Upscaler
app.py
CHANGED
@@ -11,11 +11,11 @@ upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained("stabilityai/sd-
|
|
11 |
upscaler = upscaler.to(device)
|
12 |
pipe = pipe.to(device)
|
13 |
|
14 |
-
def genie (Prompt, negative_prompt, height, width, scale, steps, seed, upscale
|
15 |
generator = torch.Generator(device=device).manual_seed(seed)
|
16 |
if upscale == "Yes":
|
17 |
low_res_latents = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, generator=generator, output_type="latent").images
|
18 |
-
image = upscaler(
|
19 |
else:
|
20 |
image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, generator=generator).images[0]
|
21 |
return image
|
@@ -28,11 +28,6 @@ gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generat
|
|
28 |
gr.Slider(25, maximum=100, value=50, step=25),
|
29 |
gr.Slider(minimum=1, step=1, maximum=9999999999999999, randomize=True),
|
30 |
gr.Radio(["Yes", "No"], label='Upscale?'),
|
31 |
-
gr.Textbox(label='Upscaler Prompt: Optional'),
|
32 |
-
gr.Textbox(label='Upscaler Negative Prompt: Both Optional And Experimental'),
|
33 |
-
gr.Slider(minimum=0, maximum=15, value=0, step=1, label='Upscale Guidance Scale'),
|
34 |
-
gr.Slider(minimum=5, maximum=25, value=5, step=5, label='Upscaler Iterations')
|
35 |
-
|
36 |
],
|
37 |
outputs=gr.Image(label='Generated Image'),
|
38 |
title="PhotoReal V2 with SD x2 Upscaler - GPU",
|
|
|
11 |
upscaler = upscaler.to(device)
|
12 |
pipe = pipe.to(device)
|
13 |
|
14 |
+
def genie (Prompt, negative_prompt, height, width, scale, steps, seed, upscale):
|
15 |
generator = torch.Generator(device=device).manual_seed(seed)
|
16 |
if upscale == "Yes":
|
17 |
low_res_latents = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, generator=generator, output_type="latent").images
|
18 |
+
image = upscaler(Prompt, negative_prompt=negative_prompt, image=low_res_latents, num_inference_steps=5, guidance_scale=0, generator=generator).images[0]
|
19 |
else:
|
20 |
image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, generator=generator).images[0]
|
21 |
return image
|
|
|
28 |
gr.Slider(25, maximum=100, value=50, step=25),
|
29 |
gr.Slider(minimum=1, step=1, maximum=9999999999999999, randomize=True),
|
30 |
gr.Radio(["Yes", "No"], label='Upscale?'),
|
|
|
|
|
|
|
|
|
|
|
31 |
],
|
32 |
outputs=gr.Image(label='Generated Image'),
|
33 |
title="PhotoReal V2 with SD x2 Upscaler - GPU",
|