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

Method inference

visual_chatgpt.py:313–318  ·  view source on GitHub ↗
(self, image_path)

Source from the content-addressed store, hash-verified

311 description="useful when you want to know what is inside the photo. receives image_path as input. "
312 "The input to this tool should be a string, representing the image_path. ")
313 def inference(self, image_path):
314 inputs = self.processor(Image.open(image_path), return_tensors="pt").to(self.device, self.torch_dtype)
315 out = self.model.generate(**inputs)
316 captions = self.processor.decode(out[0], skip_special_tokens=True)
317 print(f"\nProcessed ImageCaptioning, Input Image: {image_path}, Output Text: {captions}")
318 return captions
319
320
321class Image2Canny:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected