Himanshu-AT commited on
Commit
2262b9a
·
1 Parent(s): f34622e

update save function

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -129,12 +129,18 @@ def download_image(image):
129
  image.save("output.png", "PNG")
130
  return "output.png"
131
 
132
- def save_details(image, mask, prompt, lora_model, strength, seed, guidance_scale, num_inference_steps):
 
 
 
 
 
133
  if isinstance(image, np.ndarray):
134
  image = Image.fromarray(image)
135
  if isinstance(mask, np.ndarray):
136
  mask = Image.fromarray(mask)
137
 
 
138
  image.save("saved_image.png", "PNG")
139
  mask.save("saved_mask.png", "PNG")
140
 
@@ -152,6 +158,7 @@ def save_details(image, mask, prompt, lora_model, strength, seed, guidance_scale
152
 
153
  # Create a ZIP file
154
  with zipfile.ZipFile("output.zip", "w") as zipf:
 
155
  zipf.write("saved_image.png")
156
  zipf.write("saved_mask.png")
157
  zipf.write("details.json")
 
129
  image.save("output.png", "PNG")
130
  return "output.png"
131
 
132
+ def save_details(result, edit_image, prompt, lora_model, strength, seed, guidance_scale, num_inference_steps):
133
+ image = edit_image["background"]
134
+ mask = edit_image["layers"][0]
135
+
136
+ if isinstance(result, np.ndarray):
137
+ result = Image.fromarray(result)
138
  if isinstance(image, np.ndarray):
139
  image = Image.fromarray(image)
140
  if isinstance(mask, np.ndarray):
141
  mask = Image.fromarray(mask)
142
 
143
+ result.save("saved_result.png", "PNG")
144
  image.save("saved_image.png", "PNG")
145
  mask.save("saved_mask.png", "PNG")
146
 
 
158
 
159
  # Create a ZIP file
160
  with zipfile.ZipFile("output.zip", "w") as zipf:
161
+ zipf.write("saved_result.png")
162
  zipf.write("saved_image.png")
163
  zipf.write("saved_mask.png")
164
  zipf.write("details.json")