ImageCaptionLoader
Load image captions.
By default, the loader utilizes the pre-trained
Salesforce BLIP image captioning model.
https://huggingface.co/Salesforce/blip-image-captioning-base
Initialize with a list of image data (bytes) or file paths
- Parameters:
images (str | Path | bytes | List[str | bytes | Path]) β Either a single image or a list of images. Accepts
image data (bytes) or file paths to images.
blip_processor (str) β The name of the pre-trained BLIP processor.
blip_model (str) β The name of the pre-trained BLIP model.
Methods
Initialize with a list of image data (bytes) or file paths
- Parameters:
images (str | Path | bytes | List[str | bytes | Path]) β Either a single image or a list of images. Accepts
image data (bytes) or file paths to images.
blip_processor (str) β The name of the pre-trained BLIP processor.
blip_model (str) β The name of the pre-trained BLIP model.
A lazy loader for Documents.
- Return type:
AsyncIterator[Document]
Load data into Document objects.
- Return type:
List[Document]
A lazy loader for Documents.
- Return type:
Iterator[Document]
Load from a list of image data or file paths
- Return type:
List[Document]
-
load_and_split(text_splitter: TextSplitter | None = None) β List[Document]
Load Documents and split into chunks. Chunks are returned as Documents.
Do not override this method. It should be considered to be deprecated!
- Parameters:
text_splitter (Optional[TextSplitter]) β TextSplitter instance to use for splitting documents.
Defaults to RecursiveCharacterTextSplitter.
- Returns:
List of Documents.
- Return type:
List[Document]
Examples using ImageCaptionLoader