MCPcopy Create free account
hub / github.com/chenfei-wu/TaskMatrix / Image2Scribble

Class Image2Scribble

visual_chatgpt.py:498–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496
497
498class 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
517class ScribbleText2Image:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected