Spaces:
Sleeping
Sleeping
update app
Browse files
app.py
CHANGED
@@ -28,9 +28,14 @@ prompt = f"A photo of {unique_id} {class_label} in a bucket"
|
|
28 |
|
29 |
# generate images
|
30 |
def infer(prompt, negative_prompt, guidance_scale=10, num_inference_steps=50):
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
output = gr.Gallery(label="Outputs").style(grid=(1,2))
|
36 |
|
|
|
28 |
|
29 |
# generate images
|
30 |
def infer(prompt, negative_prompt, guidance_scale=10, num_inference_steps=50):
|
31 |
+
neg = negative_prompt if negative_prompt else None
|
32 |
+
imgs = []
|
33 |
+
while len(imgs) < 2:
|
34 |
+
next_prompt = pipeline(prompt, negative_prompt=neg, guidance_scale=guidance_scale, num_inference_steps=num_inference_steps, num_images_per_prompt=2)
|
35 |
+
if not next_prompt.nsfw_content_detected[0]:
|
36 |
+
imgs.append(next_prompt.images[0])
|
37 |
+
|
38 |
+
return imgs
|
39 |
|
40 |
output = gr.Gallery(label="Outputs").style(grid=(1,2))
|
41 |
|