|
@@ -13,6 +13,9 @@ img_url = os.getenv('img_url')
|
|
|
def img_2_img(prompt, mask_img, img_key, img_path, output_directory):
|
|
|
with open(img_path, 'rb') as f:
|
|
|
image_data = f.read()
|
|
|
+ input_image_pil = Image.open(io.BytesIO(image_data))
|
|
|
+ width, height = input_image_pil.size
|
|
|
+
|
|
|
input_image = base64.b64encode(image_data).decode('utf-8')
|
|
|
mask = base64.b64encode(mask_img).decode('utf-8')
|
|
|
payload = {
|
|
@@ -20,7 +23,10 @@ def img_2_img(prompt, mask_img, img_key, img_path, output_directory):
|
|
|
input_image
|
|
|
],
|
|
|
"denoising_strength": 0.96,
|
|
|
+ "width": width,
|
|
|
+ "height": height,
|
|
|
"mask": mask,
|
|
|
+ "mask_blur": 8,
|
|
|
"prompt": prompt,
|
|
|
"negative_prompt": "EasyNegativeV2,(badhandv4:1.2)",
|
|
|
"batch_size": 1,
|
|
@@ -36,6 +42,11 @@ def img_2_img(prompt, mask_img, img_key, img_path, output_directory):
|
|
|
"ad_model": "face_yolov8n.pt",
|
|
|
"ad_prompt": prompt,
|
|
|
"ad_negative_prompt": "EasyNegativeV2,(badhandv4:1.2)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "ad_model": "hand_yolov8n.pt",
|
|
|
+ "ad_prompt": prompt,
|
|
|
+ "ad_negative_prompt": "EasyNegativeV2,(badhandv4:1.2)",
|
|
|
}
|
|
|
]
|
|
|
},
|
|
@@ -45,6 +56,14 @@ def img_2_img(prompt, mask_img, img_key, img_path, output_directory):
|
|
|
"input_image": input_image,
|
|
|
"module": "openpose_full",
|
|
|
"model": "control_v11p_sd15_openpose [cab727d4]",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "input_image": input_image,
|
|
|
+ "module": "canny",
|
|
|
+ "model": "control_v11p_sd15_canny [d14c016b]",
|
|
|
+ "weight": 0.36,
|
|
|
+ "starting_control_step": 0,
|
|
|
+ "ending_control_step": 0.36,
|
|
|
}
|
|
|
]
|
|
|
}
|