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

Method inference

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

Source from the content-addressed store, hash-verified

789 "like: what is the background color of the last image, how many cats in this figure, what is in this figure. "
790 "The input to this tool should be a comma separated string of two, representing the image_path and the question")
791 def inference(self, inputs):
792 image_path, question = inputs.split(",")[0], ','.join(inputs.split(',')[1:])
793 raw_image = Image.open(image_path).convert('RGB')
794 inputs = self.processor(raw_image, question, return_tensors="pt").to(self.device, self.torch_dtype)
795 out = self.model.generate(**inputs)
796 answer = self.processor.decode(out[0], skip_special_tokens=True)
797 print(f"\nProcessed VisualQuestionAnswering, Input Image: {image_path}, Input Question: {question}, "
798 f"Output Answer: {answer}")
799 return answer
800
801
802class Segmenting:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected