Spaces:
Runtime error
Runtime error
1.4 update
Browse files
app.py
CHANGED
@@ -11,14 +11,14 @@ tqdm.monitor_interval = 0
|
|
11 |
|
12 |
# Load the diffusion pipelines
|
13 |
pipe1 = StableDiffusionXLPipeline.from_pretrained(
|
14 |
-
"kayfahaarukku/UrangDiffusion-1.
|
15 |
torch_dtype=torch.float16,
|
16 |
custom_pipeline="lpw_stable_diffusion_xl",
|
17 |
)
|
18 |
pipe1.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe1.scheduler.config)
|
19 |
|
20 |
pipe2 = StableDiffusionXLPipeline.from_pretrained(
|
21 |
-
"kayfahaarukku/UrangDiffusion-1.
|
22 |
torch_dtype=torch.float16,
|
23 |
custom_pipeline="lpw_stable_diffusion_xl",
|
24 |
)
|
@@ -34,7 +34,7 @@ def generate_comparison(prompt, negative_prompt, use_defaults, resolution, guida
|
|
34 |
seed = random.randint(0, 99999999)
|
35 |
if use_defaults:
|
36 |
prompt = f"{prompt}, masterpiece, best quality, amazing quality, very aesthetic"
|
37 |
-
negative_prompt = f"nsfw, lowres, bad
|
38 |
generator = torch.manual_seed(seed)
|
39 |
|
40 |
def callback(step, timestep, latents):
|
@@ -43,7 +43,7 @@ def generate_comparison(prompt, negative_prompt, use_defaults, resolution, guida
|
|
43 |
|
44 |
width, height = map(int, resolution.split('x'))
|
45 |
|
46 |
-
# Generate image with UrangDiffusion-1.
|
47 |
image1 = pipe1(
|
48 |
prompt,
|
49 |
negative_prompt=negative_prompt,
|
@@ -56,7 +56,7 @@ def generate_comparison(prompt, negative_prompt, use_defaults, resolution, guida
|
|
56 |
callback_steps=1
|
57 |
).images[0]
|
58 |
|
59 |
-
# Generate image with UrangDiffusion-1.
|
60 |
image2 = pipe2(
|
61 |
prompt,
|
62 |
negative_prompt=negative_prompt,
|
@@ -85,8 +85,8 @@ def reset_inputs():
|
|
85 |
|
86 |
with gr.Blocks(title="UrangDiffusion Comparison Demo", theme="NoCrypt/miku@1.2.1") as demo:
|
87 |
gr.HTML(
|
88 |
-
"<h1>UrangDiffusion 1.
|
89 |
-
"This demo showcases a comparison between UrangDiffusion 1.
|
90 |
)
|
91 |
with gr.Row():
|
92 |
with gr.Column():
|
@@ -101,8 +101,8 @@ with gr.Blocks(title="UrangDiffusion Comparison Demo", theme="NoCrypt/miku@1.2.1
|
|
101 |
label="Resolution",
|
102 |
value="896x1152"
|
103 |
)
|
104 |
-
guidance_scale_input = gr.Slider(minimum=1, maximum=20, step=0.5, label="Guidance Scale", value=
|
105 |
-
num_inference_steps_input = gr.Slider(minimum=1, maximum=100, step=1, label="Number of Inference Steps", value=
|
106 |
seed_input = gr.Slider(minimum=0, maximum=99999999, step=1, label="Seed", value=0, interactive=True)
|
107 |
randomize_seed_input = gr.Checkbox(label="Randomize Seed", value=True)
|
108 |
generate_button = gr.Button("Generate Comparison")
|
@@ -110,8 +110,8 @@ with gr.Blocks(title="UrangDiffusion Comparison Demo", theme="NoCrypt/miku@1.2.1
|
|
110 |
|
111 |
with gr.Column():
|
112 |
with gr.Row():
|
113 |
-
output_image1 = gr.Image(type="pil", label="UrangDiffusion 1.
|
114 |
-
output_image2 = gr.Image(type="pil", label="UrangDiffusion 1.
|
115 |
with gr.Accordion("Parameters", open=False):
|
116 |
gr.Markdown(
|
117 |
"""
|
@@ -124,7 +124,7 @@ with gr.Blocks(title="UrangDiffusion Comparison Demo", theme="NoCrypt/miku@1.2.1
|
|
124 |
### Recommended prompt formatting:
|
125 |
`1girl/1boy, character name, from what series, everything else in any order, masterpiece, best quality`
|
126 |
|
127 |
-
**PS:** `masterpiece, best quality` is automatically added when "Use Default Quality Tags and Negative Prompt" is enabled
|
128 |
|
129 |
### Recommended settings:
|
130 |
- Steps: 25-30
|
|
|
11 |
|
12 |
# Load the diffusion pipelines
|
13 |
pipe1 = StableDiffusionXLPipeline.from_pretrained(
|
14 |
+
"kayfahaarukku/UrangDiffusion-1.3",
|
15 |
torch_dtype=torch.float16,
|
16 |
custom_pipeline="lpw_stable_diffusion_xl",
|
17 |
)
|
18 |
pipe1.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe1.scheduler.config)
|
19 |
|
20 |
pipe2 = StableDiffusionXLPipeline.from_pretrained(
|
21 |
+
"kayfahaarukku/UrangDiffusion-1.4",
|
22 |
torch_dtype=torch.float16,
|
23 |
custom_pipeline="lpw_stable_diffusion_xl",
|
24 |
)
|
|
|
34 |
seed = random.randint(0, 99999999)
|
35 |
if use_defaults:
|
36 |
prompt = f"{prompt}, masterpiece, best quality, amazing quality, very aesthetic"
|
37 |
+
negative_prompt = f"nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract], {negative_prompt}"
|
38 |
generator = torch.manual_seed(seed)
|
39 |
|
40 |
def callback(step, timestep, latents):
|
|
|
43 |
|
44 |
width, height = map(int, resolution.split('x'))
|
45 |
|
46 |
+
# Generate image with UrangDiffusion-1.3
|
47 |
image1 = pipe1(
|
48 |
prompt,
|
49 |
negative_prompt=negative_prompt,
|
|
|
56 |
callback_steps=1
|
57 |
).images[0]
|
58 |
|
59 |
+
# Generate image with UrangDiffusion-1.4
|
60 |
image2 = pipe2(
|
61 |
prompt,
|
62 |
negative_prompt=negative_prompt,
|
|
|
85 |
|
86 |
with gr.Blocks(title="UrangDiffusion Comparison Demo", theme="NoCrypt/miku@1.2.1") as demo:
|
87 |
gr.HTML(
|
88 |
+
"<h1>UrangDiffusion 1.3 vs 1.4 Comparison Demo</h1>"
|
89 |
+
"This demo showcases a comparison between UrangDiffusion 1.3 and 1.4."
|
90 |
)
|
91 |
with gr.Row():
|
92 |
with gr.Column():
|
|
|
101 |
label="Resolution",
|
102 |
value="896x1152"
|
103 |
)
|
104 |
+
guidance_scale_input = gr.Slider(minimum=1, maximum=20, step=0.5, label="Guidance Scale", value=5)
|
105 |
+
num_inference_steps_input = gr.Slider(minimum=1, maximum=100, step=1, label="Number of Inference Steps", value=26)
|
106 |
seed_input = gr.Slider(minimum=0, maximum=99999999, step=1, label="Seed", value=0, interactive=True)
|
107 |
randomize_seed_input = gr.Checkbox(label="Randomize Seed", value=True)
|
108 |
generate_button = gr.Button("Generate Comparison")
|
|
|
110 |
|
111 |
with gr.Column():
|
112 |
with gr.Row():
|
113 |
+
output_image1 = gr.Image(type="pil", label="UrangDiffusion 1.3")
|
114 |
+
output_image2 = gr.Image(type="pil", label="UrangDiffusion 1.4")
|
115 |
with gr.Accordion("Parameters", open=False):
|
116 |
gr.Markdown(
|
117 |
"""
|
|
|
124 |
### Recommended prompt formatting:
|
125 |
`1girl/1boy, character name, from what series, everything else in any order, masterpiece, best quality`
|
126 |
|
127 |
+
**PS:** `masterpiece, best quality, amazing quality, very aesthetic` is automatically added when "Use Default Quality Tags and Negative Prompt" is enabled
|
128 |
|
129 |
### Recommended settings:
|
130 |
- Steps: 25-30
|