Spaces:
Runtime error
Runtime error
Commit
·
d377f1d
1
Parent(s):
cd2f644
Update caption_anything/captioner/blip2.py
Browse files
caption_anything/captioner/blip2.py
CHANGED
@@ -24,7 +24,7 @@ class BLIP2Captioner(BaseCaptioner):
|
|
24 |
image = load_image(image, return_type="pil")
|
25 |
|
26 |
if not self.dialogue:
|
27 |
-
text_prompt = '
|
28 |
inputs = self.processor(image, text = text_prompt, return_tensors="pt").to(self.device, self.torch_dtype)
|
29 |
out = self.model.generate(**inputs, max_new_tokens=50)
|
30 |
captions = self.processor.decode(out[0], skip_special_tokens=True).strip()
|
|
|
24 |
image = load_image(image, return_type="pil")
|
25 |
|
26 |
if not self.dialogue:
|
27 |
+
text_prompt = 'Question: what does the image show? Answer:'
|
28 |
inputs = self.processor(image, text = text_prompt, return_tensors="pt").to(self.device, self.torch_dtype)
|
29 |
out = self.model.generate(**inputs, max_new_tokens=50)
|
30 |
captions = self.processor.decode(out[0], skip_special_tokens=True).strip()
|