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

Class Image2Pose

visual_chatgpt.py:554–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552
553
554class Image2Pose:
555 def __init__(self, device):
556 print("Initializing Image2Pose")
557 self.detector = OpenposeDetector.from_pretrained('lllyasviel/ControlNet')
558
559 @prompts(name="Pose Detection On Image",
560 description="useful when you want to detect the human pose of the image. "
561 "like: generate human poses of this image, or generate a pose image from this image. "
562 "The input to this tool should be a string, representing the image_path")
563 def inference(self, inputs):
564 image = Image.open(inputs)
565 pose = self.detector(image)
566 updated_image_path = get_new_image_name(inputs, func_name="human-pose")
567 pose.save(updated_image_path)
568 print(f"\nProcessed Image2Pose, Input Image: {inputs}, Output Pose: {updated_image_path}")
569 return updated_image_path
570
571
572class PoseText2Image:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected