[FlaxStableDiffusionPipeline] fix bug when nsfw is detected (#832)

fix nsfw bug
This commit is contained in:
Suraj Patil 2022-10-13 21:05:17 +02:00 committed by GitHub
parent 0679d09083
commit effe9d66eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -291,7 +291,8 @@ class FlaxStableDiffusionPipeline(FlaxDiffusionPipeline):
# block images
if any(has_nsfw_concept):
for i, is_nsfw in enumerate(has_nsfw_concept):
images[i] = np.asarray(images_uint8_casted[i])
if is_nsfw:
images[i] = np.asarray(images_uint8_casted[i])
images = images.reshape(num_devices, batch_size, height, width, 3)
else: