Spaces:
Running
Running
kayfahaarukku
commited on
Commit
•
1848f7a
1
Parent(s):
f80ce9c
UrgDiff 1.4 update :v
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ tqdm.monitor_interval = 0
|
|
11 |
|
12 |
# Load the diffusion pipeline
|
13 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
14 |
-
"kayfahaarukku/UrangDiffusion-1.
|
15 |
torch_dtype=torch.float16,
|
16 |
custom_pipeline="lpw_stable_diffusion_xl",
|
17 |
)
|
@@ -26,7 +26,7 @@ def generate_image(prompt, negative_prompt, use_defaults, resolution, guidance_s
|
|
26 |
seed = random.randint(0, 99999999)
|
27 |
if use_defaults:
|
28 |
prompt = f"{prompt}, masterpiece, best quality, amazing quality, very aesthetic"
|
29 |
-
negative_prompt = f"nsfw, lowres, bad
|
30 |
generator = torch.manual_seed(seed)
|
31 |
|
32 |
def callback(step, timestep, latents):
|
@@ -60,9 +60,9 @@ def interface_fn(prompt, negative_prompt, use_defaults, resolution, guidance_sca
|
|
60 |
def reset_inputs():
|
61 |
return gr.update(value=''), gr.update(value=''), gr.update(value=True), gr.update(value='832x1216'), gr.update(value=7), gr.update(value=28), gr.update(value=0), gr.update(value=True), gr.update(value='')
|
62 |
|
63 |
-
with gr.Blocks(title="UrangDiffusion 1.
|
64 |
gr.HTML(
|
65 |
-
"<h1>UrangDiffusion 1.
|
66 |
"This demo is intended to showcase what the model is capable of and is not intended to be the main generation platform. Results produced with Diffusers are not the best, and it's highly recommended for you to get the model running inside Stable Diffusion WebUI or ComfyUI."
|
67 |
)
|
68 |
with gr.Row():
|
@@ -76,10 +76,10 @@ with gr.Blocks(title="UrangDiffusion 1.3 Demo", theme="NoCrypt/[email protected]") as d
|
|
76 |
"1344x768", "768x1344", "1536x640", "640x1536"
|
77 |
],
|
78 |
label="Resolution",
|
79 |
-
value="
|
80 |
)
|
81 |
-
guidance_scale_input = gr.Slider(minimum=1, maximum=20, step=0.5, label="Guidance Scale", value=
|
82 |
-
num_inference_steps_input = gr.Slider(minimum=1, maximum=100, step=1, label="Number of Inference Steps", value=
|
83 |
seed_input = gr.Slider(minimum=0, maximum=99999999, step=1, label="Seed", value=0, interactive=True)
|
84 |
randomize_seed_input = gr.Checkbox(label="Randomize Seed", value=True)
|
85 |
generate_button = gr.Button("Generate")
|
@@ -97,9 +97,9 @@ with gr.Blocks(title="UrangDiffusion 1.3 Demo", theme="NoCrypt/[email protected]") as d
|
|
97 |
gr.Markdown(
|
98 |
"""
|
99 |
### Recommended prompt formatting:
|
100 |
-
`1girl/1boy, character name, from what series, everything else in any order, masterpiece, best quality
|
101 |
|
102 |
-
**PS:** `masterpiece, best quality
|
103 |
|
104 |
### Recommended settings:
|
105 |
- Steps: 25-30
|
|
|
11 |
|
12 |
# Load the diffusion pipeline
|
13 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
14 |
+
"kayfahaarukku/UrangDiffusion-1.4",
|
15 |
torch_dtype=torch.float16,
|
16 |
custom_pipeline="lpw_stable_diffusion_xl",
|
17 |
)
|
|
|
26 |
seed = random.randint(0, 99999999)
|
27 |
if use_defaults:
|
28 |
prompt = f"{prompt}, masterpiece, best quality, amazing quality, very aesthetic"
|
29 |
+
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}"
|
30 |
generator = torch.manual_seed(seed)
|
31 |
|
32 |
def callback(step, timestep, latents):
|
|
|
60 |
def reset_inputs():
|
61 |
return gr.update(value=''), gr.update(value=''), gr.update(value=True), gr.update(value='832x1216'), gr.update(value=7), gr.update(value=28), gr.update(value=0), gr.update(value=True), gr.update(value='')
|
62 |
|
63 |
+
with gr.Blocks(title="UrangDiffusion 1.4 Demo", theme="NoCrypt/[email protected]") as demo:
|
64 |
gr.HTML(
|
65 |
+
"<h1>UrangDiffusion 1.4 Demo</h1>"
|
66 |
"This demo is intended to showcase what the model is capable of and is not intended to be the main generation platform. Results produced with Diffusers are not the best, and it's highly recommended for you to get the model running inside Stable Diffusion WebUI or ComfyUI."
|
67 |
)
|
68 |
with gr.Row():
|
|
|
76 |
"1344x768", "768x1344", "1536x640", "640x1536"
|
77 |
],
|
78 |
label="Resolution",
|
79 |
+
value="896x1152"
|
80 |
)
|
81 |
+
guidance_scale_input = gr.Slider(minimum=1, maximum=20, step=0.5, label="Guidance Scale", value=5)
|
82 |
+
num_inference_steps_input = gr.Slider(minimum=1, maximum=100, step=1, label="Number of Inference Steps", value=26)
|
83 |
seed_input = gr.Slider(minimum=0, maximum=99999999, step=1, label="Seed", value=0, interactive=True)
|
84 |
randomize_seed_input = gr.Checkbox(label="Randomize Seed", value=True)
|
85 |
generate_button = gr.Button("Generate")
|
|
|
97 |
gr.Markdown(
|
98 |
"""
|
99 |
### Recommended prompt formatting:
|
100 |
+
`1girl/1boy, character name, from what series, everything else in any order, masterpiece, best quality, amazing quality, very aesthetic,`
|
101 |
|
102 |
+
**PS:** `masterpiece, best quality, amazing quality, very aesthetic,` is automatically added when "Use Default Quality Tags and Negative Prompt" is enabled
|
103 |
|
104 |
### Recommended settings:
|
105 |
- Steps: 25-30
|