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

Class Image2Line

visual_chatgpt.py:382–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380
381
382class Image2Line:
383 def __init__(self, device):
384 print("Initializing Image2Line")
385 self.detector = MLSDdetector.from_pretrained('lllyasviel/ControlNet')
386
387 @prompts(name="Line Detection On Image",
388 description="useful when you want to detect the straight line of the image. "
389 "like: detect the straight lines of this image, or straight line detection on image, "
390 "or perform straight line detection on this image, or detect the straight line image of this image. "
391 "The input to this tool should be a string, representing the image_path")
392 def inference(self, inputs):
393 image = Image.open(inputs)
394 mlsd = self.detector(image)
395 updated_image_path = get_new_image_name(inputs, func_name="line-of")
396 mlsd.save(updated_image_path)
397 print(f"\nProcessed Image2Line, Input Image: {inputs}, Output Line: {updated_image_path}")
398 return updated_image_path
399
400
401class LineText2Image:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected