MCPcopy
hub / github.com/chenfei-wu/TaskMatrix / inference

Method inference

visual_chatgpt.py:633–645  ·  view source on GitHub ↗
(self, inputs)

Source from the content-addressed store, hash-verified

631 "The input to this tool should be a comma separated string of two, "
632 "representing the image_path and the user description")
633 def inference(self, inputs):
634 image_path, instruct_text = inputs.split(",")[0], ','.join(inputs.split(',')[1:])
635 image = Image.open(image_path)
636 self.seed = random.randint(0, 65535)
637 seed_everything(self.seed)
638 prompt = f'{instruct_text}, {self.a_prompt}'
639 image = self.pipe(prompt, image, num_inference_steps=20, eta=0.0, negative_prompt=self.n_prompt,
640 guidance_scale=9.0).images[0]
641 updated_image_path = get_new_image_name(image_path, func_name="segment2image")
642 image.save(updated_image_path)
643 print(f"\nProcessed SegText2Image, Input Seg: {image_path}, Input Text: {instruct_text}, "
644 f"Output Image: {updated_image_path}")
645 return updated_image_path
646
647
648class Image2Depth:

Callers

nothing calls this directly

Calls 2

seed_everythingFunction · 0.85
get_new_image_nameFunction · 0.85

Tested by

no test coverage detected