| 496 | |
| 497 | |
| 498 | class Image2Scribble: |
| 499 | def __init__(self, device): |
| 500 | print("Initializing Image2Scribble") |
| 501 | self.detector = HEDdetector.from_pretrained('lllyasviel/ControlNet') |
| 502 | |
| 503 | @prompts(name="Sketch Detection On Image", |
| 504 | description="useful when you want to generate a scribble of the image. " |
| 505 | "like: generate a scribble of this image, or generate a sketch from this image, " |
| 506 | "detect the sketch from this image. " |
| 507 | "The input to this tool should be a string, representing the image_path") |
| 508 | def inference(self, inputs): |
| 509 | image = Image.open(inputs) |
| 510 | scribble = self.detector(image, scribble=True) |
| 511 | updated_image_path = get_new_image_name(inputs, func_name="scribble") |
| 512 | scribble.save(updated_image_path) |
| 513 | print(f"\nProcessed Image2Scribble, Input Image: {inputs}, Output Scribble: {updated_image_path}") |
| 514 | return updated_image_path |
| 515 | |
| 516 | |
| 517 | class ScribbleText2Image: |
nothing calls this directly
no outgoing calls
no test coverage detected