Change style of image.
(self, inputs)
| 260 | "The input to this tool should be a comma separated string of two, " |
| 261 | "representing the image_path and the text. ") |
| 262 | def inference(self, inputs): |
| 263 | """Change style of image.""" |
| 264 | print("===>Starting InstructPix2Pix Inference") |
| 265 | image_path, text = inputs.split(",")[0], ','.join(inputs.split(',')[1:]) |
| 266 | original_image = Image.open(image_path) |
| 267 | image = self.pipe(text, image=original_image, num_inference_steps=40, image_guidance_scale=1.2).images[0] |
| 268 | updated_image_path = get_new_image_name(image_path, func_name="pix2pix") |
| 269 | image.save(updated_image_path) |
| 270 | print(f"\nProcessed InstructPix2Pix, Input Image: {image_path}, Instruct Text: {text}, " |
| 271 | f"Output Image: {updated_image_path}") |
| 272 | return updated_image_path |
| 273 | |
| 274 | |
| 275 | class Text2Image: |
nothing calls this directly
no test coverage detected