Spaces:
Runtime error
Runtime error
add more
Browse files
app.py
CHANGED
|
@@ -114,6 +114,39 @@ J9_pipe = StableDiffusionXLPipeline.from_pretrained(
|
|
| 114 |
)
|
| 115 |
J9_pipe.to("cuda")
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
@spaces.GPU
|
| 118 |
def run_comparison(prompt: str,
|
| 119 |
negative_prompt: str = "",
|
|
@@ -168,6 +201,43 @@ def run_comparison(prompt: str,
|
|
| 168 |
output_type="pil",
|
| 169 |
).images
|
| 170 |
image_paths_r5 = [save_image(img) for img in image_r5]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
return image_paths_r3, image_paths_r4,image_paths_r5, seed
|
| 172 |
|
| 173 |
examples = ["A dignified beaver wearing glasses, a vest, and colorful neck tie.",
|
|
@@ -259,8 +329,17 @@ with gr.Blocks(theme=gr.themes.Base()) as demo:
|
|
| 259 |
gr.Markdown("## [Juggernaut-XL-10](https://huggingface.co)")
|
| 260 |
with gr.Column():
|
| 261 |
image_r5 = gr.Gallery(label="Juggernaut-XL-9",columns=1, preview=True,)
|
| 262 |
-
gr.Markdown("## [Juggernaut-XL-9](https://huggingface.co)")
|
| 263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
gr.on(
|
| 265 |
triggers=[prompt.submit, run.click],
|
| 266 |
fn=run_comparison,
|
|
|
|
| 114 |
)
|
| 115 |
J9_pipe.to("cuda")
|
| 116 |
|
| 117 |
+
j8_pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 118 |
+
"RunDiffusion/Juggernaut-XL-v8",
|
| 119 |
+
vae=vae,
|
| 120 |
+
torch_dtype=torch.float16,
|
| 121 |
+
custom_pipeline="lpw_stable_diffusion_xl",
|
| 122 |
+
use_safetensors=True,
|
| 123 |
+
add_watermarker=False,
|
| 124 |
+
variant="fp16",
|
| 125 |
+
)
|
| 126 |
+
J8_pipe.to("cuda")
|
| 127 |
+
|
| 128 |
+
j7_pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 129 |
+
"RunDiffusion/Juggernaut-XL-v7",
|
| 130 |
+
vae=vae,
|
| 131 |
+
torch_dtype=torch.float16,
|
| 132 |
+
custom_pipeline="lpw_stable_diffusion_xl",
|
| 133 |
+
use_safetensors=True,
|
| 134 |
+
add_watermarker=False,
|
| 135 |
+
variant="fp16",
|
| 136 |
+
)
|
| 137 |
+
J7_pipe.to("cuda")
|
| 138 |
+
|
| 139 |
+
j_pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 140 |
+
"RunDiffusion/Juggernaut-XL",
|
| 141 |
+
vae=vae,
|
| 142 |
+
torch_dtype=torch.float16,
|
| 143 |
+
custom_pipeline="lpw_stable_diffusion_xl",
|
| 144 |
+
use_safetensors=True,
|
| 145 |
+
add_watermarker=False,
|
| 146 |
+
variant="fp16",
|
| 147 |
+
)
|
| 148 |
+
J_pipe.to("cuda")
|
| 149 |
+
|
| 150 |
@spaces.GPU
|
| 151 |
def run_comparison(prompt: str,
|
| 152 |
negative_prompt: str = "",
|
|
|
|
| 201 |
output_type="pil",
|
| 202 |
).images
|
| 203 |
image_paths_r5 = [save_image(img) for img in image_r5]
|
| 204 |
+
|
| 205 |
+
image_r6 = J8_pipe(prompt=prompt,
|
| 206 |
+
negative_prompt=negative_prompt,
|
| 207 |
+
width=width,
|
| 208 |
+
height=height,
|
| 209 |
+
guidance_scale=guidance_scale,
|
| 210 |
+
num_inference_steps=num_inference_steps,
|
| 211 |
+
num_images_per_prompt=num_images_per_prompt,
|
| 212 |
+
cross_attention_kwargs={"scale": 0.65},
|
| 213 |
+
output_type="pil",
|
| 214 |
+
).images
|
| 215 |
+
image_paths_r6 = [save_image(img) for img in image_r6]
|
| 216 |
+
|
| 217 |
+
image_r7 = J7_pipe(prompt=prompt,
|
| 218 |
+
negative_prompt=negative_prompt,
|
| 219 |
+
width=width,
|
| 220 |
+
height=height,
|
| 221 |
+
guidance_scale=guidance_scale,
|
| 222 |
+
num_inference_steps=num_inference_steps,
|
| 223 |
+
num_images_per_prompt=num_images_per_prompt,
|
| 224 |
+
cross_attention_kwargs={"scale": 0.65},
|
| 225 |
+
output_type="pil",
|
| 226 |
+
).images
|
| 227 |
+
image_paths_r7 = [save_image(img) for img in image_r7]
|
| 228 |
+
|
| 229 |
+
image_r8 = J_pipe(prompt=prompt,
|
| 230 |
+
negative_prompt=negative_prompt,
|
| 231 |
+
width=width,
|
| 232 |
+
height=height,
|
| 233 |
+
guidance_scale=guidance_scale,
|
| 234 |
+
num_inference_steps=num_inference_steps,
|
| 235 |
+
num_images_per_prompt=num_images_per_prompt,
|
| 236 |
+
cross_attention_kwargs={"scale": 0.65},
|
| 237 |
+
output_type="pil",
|
| 238 |
+
).images
|
| 239 |
+
image_paths_r8 = [save_image(img) for img in image_r8]
|
| 240 |
+
|
| 241 |
return image_paths_r3, image_paths_r4,image_paths_r5, seed
|
| 242 |
|
| 243 |
examples = ["A dignified beaver wearing glasses, a vest, and colorful neck tie.",
|
|
|
|
| 329 |
gr.Markdown("## [Juggernaut-XL-10](https://huggingface.co)")
|
| 330 |
with gr.Column():
|
| 331 |
image_r5 = gr.Gallery(label="Juggernaut-XL-9",columns=1, preview=True,)
|
| 332 |
+
gr.Markdown("## [Juggernaut-XL-9](https://huggingface.co)")
|
| 333 |
+
with gr.Column():
|
| 334 |
+
image_r6 = gr.Gallery(label="Juggernaut-XL-8",columns=1, preview=True,)
|
| 335 |
+
gr.Markdown("## [Juggernaut-XL-8](https://huggingface.co)")
|
| 336 |
+
with gr.Column():
|
| 337 |
+
image_r7 = gr.Gallery(label="Juggernaut-XL-7",columns=1, preview=True,)
|
| 338 |
+
gr.Markdown("## [Juggernaut-XL-7](https://huggingface.co)")
|
| 339 |
+
with gr.Column():
|
| 340 |
+
image_r8 = gr.Gallery(label="Juggernaut-XL",columns=1, preview=True,)
|
| 341 |
+
gr.Markdown("## [Juggernaut-XL](https://huggingface.co)")
|
| 342 |
+
image_outputs = [image_r3, image_r4, image_r5, image_r6, image_r7, image_r8]
|
| 343 |
gr.on(
|
| 344 |
triggers=[prompt.submit, run.click],
|
| 345 |
fn=run_comparison,
|