CultriX commited on
Commit
5aa8acd
1 Parent(s): d01f1d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -125,8 +125,9 @@ def generate_image_to_image(prompt_mash, image_input_path, image_strength, steps
125
  final_image.save(temp_file.name, "PNG")
126
 
127
  # Convert the image to a base64 string
128
- with open(temp_file.name, "rb") as f:
129
- img_base64 = base64.b64encode(f.read()).decode("utf-8")
 
130
 
131
  return final_image, temp_file.name, f"data:image/png;base64,{img_base64}"
132
 
 
125
  final_image.save(temp_file.name, "PNG")
126
 
127
  # Convert the image to a base64 string
128
+ buffered = io.BytesIO()
129
+ final_image.save(buffered, format="PNG")
130
+ img_base64 = base64.b64encode(buffered.getvalue()).decode("utf-8")
131
 
132
  return final_image, temp_file.name, f"data:image/png;base64,{img_base64}"
133