(self, inputs)
| 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 | |
| 802 | class Segmenting: |
nothing calls this directly
no outgoing calls
no test coverage detected