fix: skip generation

This commit is contained in:
Radionic
2023-12-20 17:32:44 +08:00
parent 420fbff0b9
commit 41ea7fedaa
2 changed files with 14 additions and 14 deletions
+12 -12
View File
@@ -299,18 +299,18 @@ async def post_prompt_block(request):
api_prompt = json.loads(workflow)
# skip generation part if base_image is provided
# if base_image is not None:
# for value in api_prompt.values():
# if (
# value["class_type"] == "LoadImageFromRequest"
# and value["inputs"]["name"] == image_path
# ):
# del value["inputs"]["image"]
# elif (
# value["class_type"] == "PreviewImage"
# or value["class_type"] == "SaveImage"
# ):
# del value["inputs"]["images"]
if base_image is not None:
for value in api_prompt.values():
if (
value["class_type"] == "LoadImageFromRequest"
and value["inputs"]["name"] == image_path
):
del value["inputs"]["image"]
elif (
value["class_type"] == "PreviewImage"
or value["class_type"] == "SaveImage"
):
value["inputs"] = {}
res = post_prompt({"prompt": api_prompt})
prompt_id = json.loads(res.text)["prompt_id"]
+2 -2
View File
@@ -280,7 +280,7 @@ class SAMMultiLayer:
return imagePromptsMulti, boxesMulti
def load_image(self, image, ckpt, embedding_id, image_prompts_json):
image_prompts = json.loads(image_prompts_json)
image_prompts = json.loads(image_prompts_json.replace("'", '"'))
order_file = f"{self.output_dir}/segments_{embedding_id}/order.json"
if os.path.exists(order_file):
@@ -337,7 +337,7 @@ class SAMMultiLayer:
imagePromptsMulti, boxesMulti = self.detect_face(image[0].numpy())
image_prompts = json.loads(image_prompts_json)
image_prompts = json.loads(image_prompts_json.replace("'", '"'))
result = [image_prompts]
if isinstance(image_prompts, list):