Spaces:
Sleeping
Sleeping
Update core/image_generator.py
Browse files- core/image_generator.py +9 -6
core/image_generator.py
CHANGED
|
@@ -529,10 +529,13 @@ async def generate_images(prompt_or_json, seed: int | None = None, num_images: i
|
|
| 529 |
pipe = load_pipeline()
|
| 530 |
images = []
|
| 531 |
for i in range(num_images):
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
|
|
|
|
|
|
|
|
|
| 538 |
|
|
|
|
| 529 |
pipe = load_pipeline()
|
| 530 |
images = []
|
| 531 |
for i in range(num_images):
|
| 532 |
+
gen = torch.Generator(device).manual_seed(seed + i) if seed is not None else None
|
| 533 |
+
try:
|
| 534 |
+
img = pipe(prompt_or_json, num_inference_steps=30, generator=gen).images[0]
|
| 535 |
+
img_path = TMP_DIR / f"prompt_{i}.png"
|
| 536 |
+
img.save(img_path)
|
| 537 |
+
images.append(pil_to_base64(img))
|
| 538 |
+
except Exception as e:
|
| 539 |
+
print(f"[ImageGen] ⚠️ Failed on image {i}: {e}")
|
| 540 |
+
|
| 541 |
|