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

Method __init__

visual_chatgpt.py:302–308  ·  view source on GitHub ↗
(self, device)

Source from the content-addressed store, hash-verified

300
301class ImageCaptioning:
302 def __init__(self, device):
303 print(f"Initializing ImageCaptioning to {device}")
304 self.device = device
305 self.torch_dtype = torch.float16 if 'cuda' in device else torch.float32
306 self.processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
307 self.model = BlipForConditionalGeneration.from_pretrained(
308 "Salesforce/blip-image-captioning-base", torch_dtype=self.torch_dtype).to(self.device)
309
310 @prompts(name="Get Photo Description",
311 description="useful when you want to know what is inside the photo. receives image_path as input. "

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected