Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,11 @@ from diffusers import DiffusionPipeline
|
|
4 |
def generate_image(modelsyu, prompt, negative_prompt):
|
5 |
pipeline = DiffusionPipeline.from_pretrained(modelsyu)
|
6 |
pipeline.to("cpu")
|
7 |
-
#
|
8 |
-
|
9 |
image = pipeline(prompt, negative_prompt=negative_prompt).images[0]
|
10 |
-
|
|
|
11 |
image = pipeline(prompt).images[0]
|
12 |
return image
|
13 |
|
|
|
4 |
def generate_image(modelsyu, prompt, negative_prompt):
|
5 |
pipeline = DiffusionPipeline.from_pretrained(modelsyu)
|
6 |
pipeline.to("cpu")
|
7 |
+
# Attempt to generate an image with the negative prompt if supported
|
8 |
+
try:
|
9 |
image = pipeline(prompt, negative_prompt=negative_prompt).images[0]
|
10 |
+
except TypeError:
|
11 |
+
# Fallback if negative_prompt is not supported
|
12 |
image = pipeline(prompt).images[0]
|
13 |
return image
|
14 |
|