Spaces:
Paused
Paused
P01yH3dr0n
commited on
Commit
•
9e64d02
1
Parent(s):
bccca12
Update utils.py
Browse files
utils.py
CHANGED
@@ -91,7 +91,7 @@ def generate_novelai_image(
|
|
91 |
if selection == 'inp' and inp_img['background'].getextrema()[3][1] > 0:
|
92 |
payload['action'] = "infill"
|
93 |
payload['model'] = 'nai-diffusion-3-inpainting'
|
94 |
-
payload['parameters']['mask'] = image2base64(
|
95 |
payload['parameters']['image'] = image2base64(inp_img['background'])
|
96 |
payload['parameters']['extra_noise_seed'] = seed
|
97 |
if i2i_image is not None and selection == 'i2i':
|
@@ -131,10 +131,4 @@ def image2base64(img):
|
|
131 |
img.save(output_buffer, format='PNG' if img.mode=='RGBA' else 'JPEG')
|
132 |
byte_data = output_buffer.getvalue()
|
133 |
base64_str = base64.b64encode(byte_data).decode()
|
134 |
-
return base64_str
|
135 |
-
|
136 |
-
def convert_mask(img):
|
137 |
-
a = img.split()[3]
|
138 |
-
base = Image.new('RGB', img.size, 'white')
|
139 |
-
base.putalpha(a)
|
140 |
-
return base
|
|
|
91 |
if selection == 'inp' and inp_img['background'].getextrema()[3][1] > 0:
|
92 |
payload['action'] = "infill"
|
93 |
payload['model'] = 'nai-diffusion-3-inpainting'
|
94 |
+
payload['parameters']['mask'] = image2base64(inp_img['layers'][0])
|
95 |
payload['parameters']['image'] = image2base64(inp_img['background'])
|
96 |
payload['parameters']['extra_noise_seed'] = seed
|
97 |
if i2i_image is not None and selection == 'i2i':
|
|
|
131 |
img.save(output_buffer, format='PNG' if img.mode=='RGBA' else 'JPEG')
|
132 |
byte_data = output_buffer.getvalue()
|
133 |
base64_str = base64.b64encode(byte_data).decode()
|
134 |
+
return base64_str
|
|
|
|
|
|
|
|
|
|
|
|