Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ def infer(source_img, prompt, guide, steps, seed, strength):
|
|
46 |
source_image = Image.open(source_img).convert("RGB")
|
47 |
source_image = source_image.resize((512, 512), Image.Resampling.LANCZOS)
|
48 |
|
49 |
-
|
50 |
[prompt],
|
51 |
image=source_image,
|
52 |
strength=strength,
|
@@ -54,8 +54,20 @@ def infer(source_img, prompt, guide, steps, seed, strength):
|
|
54 |
num_inference_steps=steps,
|
55 |
generator=generator
|
56 |
)
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
print("Great sylvain ! Everything is working fine !")
|
61 |
|
|
|
46 |
source_image = Image.open(source_img).convert("RGB")
|
47 |
source_image = source_image.resize((512, 512), Image.Resampling.LANCZOS)
|
48 |
|
49 |
+
result = img_pipe(
|
50 |
[prompt],
|
51 |
image=source_image,
|
52 |
strength=strength,
|
|
|
54 |
num_inference_steps=steps,
|
55 |
generator=generator
|
56 |
)
|
57 |
+
|
58 |
+
output_images = result["images"]
|
59 |
+
output_paths = []
|
60 |
+
|
61 |
+
for idx, img in enumerate(output_images):
|
62 |
+
filename = f"output_{seed}_{idx}.png"
|
63 |
+
save_path = os.path.join("outputs", filename)
|
64 |
+
os.makedirs("outputs", exist_ok=True)
|
65 |
+
img.save(save_path)
|
66 |
+
print(f"Saved image to: {save_path}")
|
67 |
+
output_paths.append(save_path)
|
68 |
+
|
69 |
+
# Optional: return paths or Gradio can render them too
|
70 |
+
return output_images
|
71 |
|
72 |
print("Great sylvain ! Everything is working fine !")
|
73 |
|