Skip to content

Commit

Permalink
infer bug 修复
Browse files Browse the repository at this point in the history
  • Loading branch information
Lassi-KK committed Feb 23, 2024
1 parent 2567063 commit a18543a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions extensions/sd_EasyPhoto/scripts/easyphoto_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,7 @@ def easyphoto_infer_forward(
traceback.print_exc()
ep_logger.error(f"Skin Retouching error: {e}")

# TODO: 上采样可能存在问题
if super_resolution:
try:
ep_logger.info("Start Portrait enhancement.")
Expand Down
9 changes: 8 additions & 1 deletion modules/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,10 @@ def invocations(self, req: models.InvocationsRequest):
print(f'download template from s3: {req.s3ModeUrl} success.')

for image_format in image_formats:
# 判断是不是图片格式文件
if image_format not in ['*.jpg', '*.jpeg', '*.png', '*.webp']:
continue
print(glob(os.path.join(template_dir, image_format)))
img_list.extend(glob(os.path.join(template_dir, image_format)))
if len(img_list) == 0:
print(f"Input template dir {template_dir} contains no images")
Expand All @@ -1005,6 +1009,9 @@ def invocations(self, req: models.InvocationsRequest):
"selected_template_images": selected_template_images,
}
outputs = self.easyphoto_infer(payload_infer)
print("Infer results: ", outputs["message"])
print("Infer results numbers: ", len(outputs["outputs"]))
print("Mode images numbers: ", len(img_list))
if len(outputs["outputs"]) == len(img_list):
for idx, img_path_output in enumerate(img_list):
image = decode_image_from_base64jpeg(outputs["outputs"][idx])
Expand Down Expand Up @@ -1301,4 +1308,4 @@ def easyphoto_infer(self, datas: dict):
face_id_outputs_base64 = []
traceback.print_exc()

return {"message": comment, "outputs": outputs, "face_id_outputs": face_id_outputs_base64}
return {"message": comment, "outputs": outputs, "face_id_outputs": face_id_outputs_base64}

0 comments on commit a18543a

Please sign in to comment.