(self, inputs)
| 481 | "The input to this tool should be a comma separated string of two, " |
| 482 | "representing the image_path and the user description") |
| 483 | def inference(self, inputs): |
| 484 | image_path, instruct_text = inputs.split(",")[0], ','.join(inputs.split(',')[1:]) |
| 485 | image = Image.open(image_path) |
| 486 | self.seed = random.randint(0, 65535) |
| 487 | seed_everything(self.seed) |
| 488 | prompt = f'{instruct_text}, {self.a_prompt}' |
| 489 | image = self.pipe(prompt, image, num_inference_steps=20, eta=0.0, negative_prompt=self.n_prompt, |
| 490 | guidance_scale=9.0).images[0] |
| 491 | updated_image_path = get_new_image_name(image_path, func_name="hed2image") |
| 492 | image.save(updated_image_path) |
| 493 | print(f"\nProcessed HedText2Image, Input Hed: {image_path}, Input Text: {instruct_text}, " |
| 494 | f"Output Image: {updated_image_path}") |
| 495 | return updated_image_path |
| 496 | |
| 497 | |
| 498 | class Image2Scribble: |
nothing calls this directly
no test coverage detected