NewUserID commited on
Commit
1467618
·
verified ·
1 Parent(s): 7de1365

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
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
- images_list = img_pipe(
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
- print(images_list["images"])
58
- return images_list["images"]
 
 
 
 
 
 
 
 
 
 
 
 
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