Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -224,6 +224,14 @@ def _generate_image(prompt_embeds, image_list, width, height, num_inference_step
|
|
| 224 |
return callback_kwargs
|
| 225 |
|
| 226 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
image = pipe(
|
| 228 |
prompt_embeds=prompt_embeds,
|
| 229 |
image=image_list,
|
|
|
|
| 224 |
return callback_kwargs
|
| 225 |
|
| 226 |
try:
|
| 227 |
+
if image_list and len(image_list) > 0:
|
| 228 |
+
for img in image_list:
|
| 229 |
+
# NSFW 检测
|
| 230 |
+
if nsfw_model and nsfw_processor:
|
| 231 |
+
if detect_nsfw(img):
|
| 232 |
+
msg = "The input image contains NSFW content and cannot be generated. Please modify the input image or prompt and try again."
|
| 233 |
+
raise Exception(msg)
|
| 234 |
+
|
| 235 |
image = pipe(
|
| 236 |
prompt_embeds=prompt_embeds,
|
| 237 |
image=image_list,
|