langchain_community.document_loaders.image_captions
.ImageCaptionLoader¶
- class langchain_community.document_loaders.image_captions.ImageCaptionLoader(images: Union[str, Path, bytes, List[Union[str, bytes, Path]]], blip_processor: str = 'Salesforce/blip-image-captioning-base', blip_model: str = 'Salesforce/blip-image-captioning-base')[source]¶
加载图像标题。
默认情况下,加载器使用预训练的 Salesforce BLIP 图像标题模型。 https://huggingface.co/Salesforce/blip-image-captioning-base
用图像数据(字节)或文件路径列表初始化
- 参数:
images:单个图像或图像列表。接受图像数据(字节)或图像文件路径。 blip_processor:预训练的BLIP处理器的名称。 blip_model:预训练的BLIP模型的名称。
Methods
__init__
(images[, blip_processor, blip_model])用图像数据(字节)或文件路径列表初始化
一个用于文档的惰性加载器。
aload
()将数据加载到文档对象中。
一个用于文档的惰性加载器。
load
()从图像数据或文件路径列表中加载数据
load_and_split
([text_splitter])加载文档并分割成块。块作为文档返回。
- Parameters
images (Union[str, Path, bytes, List[Union[str, bytes, Path]]]) –
blip_processor (str) –
blip_model (str) –
- __init__(images: Union[str, Path, bytes, List[Union[str, bytes, Path]]], blip_processor: str = 'Salesforce/blip-image-captioning-base', blip_model: str = 'Salesforce/blip-image-captioning-base')[source]¶
用图像数据(字节)或文件路径列表初始化
- 参数:
images:单个图像或图像列表。接受图像数据(字节)或图像文件路径。 blip_processor:预训练的BLIP处理器的名称。 blip_model:预训练的BLIP模型的名称。
- Parameters
images (Union[str, Path, bytes, List[Union[str, bytes, Path]]]) –
blip_processor (str) –
blip_model (str) –
- load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document] ¶
加载文档并分割成块。块作为文档返回。
不要覆盖此方法。应该被视为已弃用!
- 参数:
- text_splitter: 用于分割文档的TextSplitter实例。
默认为RecursiveCharacterTextSplitter。
- 返回:
文档列表。
- Parameters
text_splitter (Optional[TextSplitter]) –
- Return type
List[Document]