Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -40,6 +40,12 @@ def generate(prompt, negative_prompt, num_inference_steps, guidance_scale, width
|
|
40 |
neg_embeds, neg_pooled = compel(negative_prompt)
|
41 |
|
42 |
progress(0.1, desc="Generating images")
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
images = pipe(
|
44 |
prompt_embeds=embeds,
|
45 |
pooled_prompt_embeds=pooled,
|
@@ -50,8 +56,7 @@ def generate(prompt, negative_prompt, num_inference_steps, guidance_scale, width
|
|
50 |
width=width,
|
51 |
height=height,
|
52 |
num_images_per_prompt=num_samples,
|
53 |
-
|
54 |
-
callback_on_step_end=lambda i, t, latents: progress((i + 1) / num_inference_steps)
|
55 |
).images
|
56 |
|
57 |
return images
|
@@ -106,7 +111,7 @@ css = """
|
|
106 |
with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
|
107 |
gr.HTML("""
|
108 |
<div class="header">
|
109 |
-
<h1>🎨
|
110 |
<p>Enter creative prompts and generate high-quality images.</p>
|
111 |
</div>
|
112 |
""")
|
|
|
40 |
neg_embeds, neg_pooled = compel(negative_prompt)
|
41 |
|
42 |
progress(0.1, desc="Generating images")
|
43 |
+
|
44 |
+
# Define proper callback for step end
|
45 |
+
def callback_on_step_end(pipe, i, t, callback_kwargs):
|
46 |
+
progress((i + 1) / num_inference_steps)
|
47 |
+
return callback_kwargs
|
48 |
+
|
49 |
images = pipe(
|
50 |
prompt_embeds=embeds,
|
51 |
pooled_prompt_embeds=pooled,
|
|
|
56 |
width=width,
|
57 |
height=height,
|
58 |
num_images_per_prompt=num_samples,
|
59 |
+
callback_on_step_end=callback_on_step_end
|
|
|
60 |
).images
|
61 |
|
62 |
return images
|
|
|
111 |
with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
|
112 |
gr.HTML("""
|
113 |
<div class="header">
|
114 |
+
<h1>🎨 Unfiltered AI NSFW-gen-v2 Image Generator</h1>
|
115 |
<p>Enter creative prompts and generate high-quality images.</p>
|
116 |
</div>
|
117 |
""")
|