Spaces:
Runtime error
Runtime error
add negative prompt syntax parsing
Browse files
stablediffusion-infinity/app.py
CHANGED
@@ -138,7 +138,11 @@ async def run_outpaint(
|
|
138 |
mask = sel_buffer[:, :, -1]
|
139 |
nmask = 255 - mask
|
140 |
process_size = 512
|
141 |
-
|
|
|
|
|
|
|
|
|
142 |
if nmask.sum() < 1:
|
143 |
print("inpaiting with fixed Mask")
|
144 |
mask = np.array(STATIC_MASK)[:, :, 0]
|
@@ -171,7 +175,8 @@ async def run_outpaint(
|
|
171 |
# mask_image=mask_image.filter(ImageFilter.GaussianBlur(radius = 8))
|
172 |
with autocast("cuda"):
|
173 |
output = inpaint(
|
174 |
-
prompt=
|
|
|
175 |
image=init_image.resize(
|
176 |
(process_size, process_size), resample=SAMPLING_MODE
|
177 |
),
|
@@ -188,7 +193,7 @@ async def run_outpaint(
|
|
188 |
|
189 |
if not is_nsfw:
|
190 |
# print("not nsfw, uploading")
|
191 |
-
image_url = await upload_file(image,
|
192 |
|
193 |
params = {
|
194 |
"is_nsfw": is_nsfw,
|
|
|
138 |
mask = sel_buffer[:, :, -1]
|
139 |
nmask = 255 - mask
|
140 |
process_size = 512
|
141 |
+
negative_syntax = r'\<(.*?)\>'
|
142 |
+
prompt = re.sub(negative_syntax, ' ', prompt_text)
|
143 |
+
negative_prompt = ' '.join(re.findall(negative_syntax, prompt_text))
|
144 |
+
print("prompt", prompt)
|
145 |
+
print("negative_prompt", negative_prompt)
|
146 |
if nmask.sum() < 1:
|
147 |
print("inpaiting with fixed Mask")
|
148 |
mask = np.array(STATIC_MASK)[:, :, 0]
|
|
|
175 |
# mask_image=mask_image.filter(ImageFilter.GaussianBlur(radius = 8))
|
176 |
with autocast("cuda"):
|
177 |
output = inpaint(
|
178 |
+
prompt=prompt,
|
179 |
+
negative_prompt=negative_prompt,
|
180 |
image=init_image.resize(
|
181 |
(process_size, process_size), resample=SAMPLING_MODE
|
182 |
),
|
|
|
193 |
|
194 |
if not is_nsfw:
|
195 |
# print("not nsfw, uploading")
|
196 |
+
image_url = await upload_file(image, prompt + "NNOTN" + negative_prompt, room_id, image_key)
|
197 |
|
198 |
params = {
|
199 |
"is_nsfw": is_nsfw,
|