Package ai.djl.modality.cv
Class VisionLanguageInput
java.lang.Object
ai.djl.modality.cv.VisionLanguageInput
The input container for a vision language model.
-
Constructor Summary
ConstructorsConstructorDescriptionVisionLanguageInput(Image image, String text) Constructs a newImageTextInputinstance.VisionLanguageInput(Image image, String[] candidates) Constructs a newImageTextInputinstance.VisionLanguageInput(Image image, String text, String[] candidates, String hypothesisTemplate) Constructs a newImageTextInputinstance. -
Method Summary
Modifier and TypeMethodDescriptionString[]Returns the candidate labels.Returns the hypothesis template.getImage()Returns the image input.getText()Returns the prompt text.static VisionLanguageInputparseInput(Input input) Returns theImageTextInputfrom theInput.voidsetCandidates(String[] candidates) Sets the candidate labels.voidsetHypothesisTemplate(String hypothesisTemplate) Sets the hypothesis template.voidSets the image input.voidSets the prompt text.
-
Constructor Details
-
VisionLanguageInput
Constructs a newImageTextInputinstance.- Parameters:
image- the image inputtext- the prompt
-
VisionLanguageInput
Constructs a newImageTextInputinstance.- Parameters:
image- the image inputcandidates- the candidate labels
-
VisionLanguageInput
public VisionLanguageInput(Image image, String text, String[] candidates, String hypothesisTemplate) Constructs a newImageTextInputinstance.- Parameters:
image- the image inputtext- the promptcandidates- the candidate labelshypothesisTemplate- the hypothesis template
-
-
Method Details
-
parseInput
Returns theImageTextInputfrom theInput.- Parameters:
input- the input object- Returns:
- the
ImageTextInputfrom theInput - Throws:
TranslateException- if the input is invalidIOException- if failed to load image
-
getImage
Returns the image input.- Returns:
- the image input
-
setImage
Sets the image input.- Parameters:
image- the image input
-
getText
Returns the prompt text.- Returns:
- the prompt text
-
setText
Sets the prompt text.- Parameters:
text- the prompt text
-
getCandidates
Returns the candidate labels.- Returns:
- the candidate labels
-
setCandidates
Sets the candidate labels.- Parameters:
candidates- the candidate labels
-
getHypothesisTemplate
Returns the hypothesis template.- Returns:
- the hypothesis template
-
setHypothesisTemplate
Sets the hypothesis template.- Parameters:
hypothesisTemplate- the hypothesis template
-