Spaces:
Sleeping
Sleeping
Update app.py
Browse filesAdded Upscaler Iterations
app.py
CHANGED
@@ -11,21 +11,24 @@ upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained("stabilityai/sd-
|
|
11 |
upscaler = upscaler.to(device)
|
12 |
pipe = pipe.to(device)
|
13 |
|
14 |
-
def genie (Prompt, negative_prompt, 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, num_inference_steps=steps, guidance_scale=scale, generator=generator, output_type="latent").images
|
18 |
-
image = upscaler(prompt='', image=low_res_latents, num_inference_steps=
|
19 |
else:
|
20 |
image = pipe(Prompt, negative_prompt=negative_prompt, num_inference_steps=steps, guidance_scale=scale, generator=generator).images[0]
|
21 |
return image
|
22 |
|
23 |
gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
|
24 |
gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
|
25 |
-
gr.Slider(1, maximum=15, value=10, step=.25, label='Prompt Guidance Scale:', interactive=True),
|
26 |
-
gr.Slider(1, maximum=100, value=50, step=1, label='Number of Iterations: 50 is typically fine.'),
|
27 |
gr.Slider(minimum=1, step=10, maximum=999999999999999999, randomize=True, interactive=True),
|
28 |
-
gr.Radio(["Yes", "No"], label='Upscale?')
|
|
|
|
|
|
|
29 |
outputs=gr.Image(label='Generated Image'),
|
30 |
title="PhotoReal V2 with SD x2 Upscaler - GPU",
|
31 |
description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",
|
|
|
11 |
upscaler = upscaler.to(device)
|
12 |
pipe = pipe.to(device)
|
13 |
|
14 |
+
def genie (Prompt, negative_prompt, scale, steps, Seed, upscale, upscale_iter):
|
15 |
generator = torch.Generator(device=device).manual_seed(Seed)
|
16 |
if upscale == "Yes":
|
17 |
low_res_latents = pipe(Prompt, negative_prompt=negative_prompt, num_inference_steps=steps, guidance_scale=scale, generator=generator, output_type="latent").images
|
18 |
+
image = upscaler(prompt='', image=low_res_latents, num_inference_steps=upscale_iter, guidance_scale=0, generator=generator).images[0]
|
19 |
else:
|
20 |
image = pipe(Prompt, negative_prompt=negative_prompt, num_inference_steps=steps, guidance_scale=scale, generator=generator).images[0]
|
21 |
return image
|
22 |
|
23 |
gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
|
24 |
gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
|
25 |
+
gr.Slider(minimum=1, maximum=15, value=10, step=.25, label='Prompt Guidance Scale:', interactive=True),
|
26 |
+
gr.Slider(minimum=1, maximum=100, value=50, step=1, label='Number of Iterations: 50 is typically fine.'),
|
27 |
gr.Slider(minimum=1, step=10, maximum=999999999999999999, randomize=True, interactive=True),
|
28 |
+
gr.Radio(["Yes", "No"], label='Upscale?'),
|
29 |
+
gr.Slider(minimum=5, maximum=25,value=5, step=5, label='Upscaler Iterations'),
|
30 |
+
|
31 |
+
],
|
32 |
outputs=gr.Image(label='Generated Image'),
|
33 |
title="PhotoReal V2 with SD x2 Upscaler - GPU",
|
34 |
description="<br><br><b/>Warning: This Demo is capable of producing NSFW content.",
|