(self, inputs)
| 365 | "The input to this tool should be a comma separated string of two, " |
| 366 | "representing the image_path and the user description. ") |
| 367 | def inference(self, inputs): |
| 368 | image_path, instruct_text = inputs.split(",")[0], ','.join(inputs.split(',')[1:]) |
| 369 | image = Image.open(image_path) |
| 370 | self.seed = random.randint(0, 65535) |
| 371 | seed_everything(self.seed) |
| 372 | prompt = f'{instruct_text}, {self.a_prompt}' |
| 373 | image = self.pipe(prompt, image, num_inference_steps=20, eta=0.0, negative_prompt=self.n_prompt, |
| 374 | guidance_scale=9.0).images[0] |
| 375 | updated_image_path = get_new_image_name(image_path, func_name="canny2image") |
| 376 | image.save(updated_image_path) |
| 377 | print(f"\nProcessed CannyText2Image, Input Canny: {image_path}, Input Text: {instruct_text}, " |
| 378 | f"Output Text: {updated_image_path}") |
| 379 | return updated_image_path |
| 380 | |
| 381 | |
| 382 | class Image2Line: |
nothing calls this directly
no test coverage detected