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 newImageTextInput
instance.VisionLanguageInput
(Image image, String[] candidates) Constructs a newImageTextInput
instance.VisionLanguageInput
(Image image, String text, String[] candidates, String hypothesisTemplate) Constructs a newImageTextInput
instance. -
Method Summary
Modifier and TypeMethodDescriptionString[]
Returns the candidate labels.Returns the hypothesis template.getImage()
Returns the image input.getText()
Returns the prompt text.static VisionLanguageInput
parseInput
(Input input) Returns theImageTextInput
from theInput
.void
setCandidates
(String[] candidates) Sets the candidate labels.void
setHypothesisTemplate
(String hypothesisTemplate) Sets the hypothesis template.void
Sets the image input.void
Sets the prompt text.
-
Constructor Details
-
VisionLanguageInput
Constructs a newImageTextInput
instance.- Parameters:
image
- the image inputtext
- the prompt
-
VisionLanguageInput
Constructs a newImageTextInput
instance.- Parameters:
image
- the image inputcandidates
- the candidate labels
-
VisionLanguageInput
public VisionLanguageInput(Image image, String text, String[] candidates, String hypothesisTemplate) Constructs a newImageTextInput
instance.- Parameters:
image
- the image inputtext
- the promptcandidates
- the candidate labelshypothesisTemplate
- the hypothesis template
-
-
Method Details
-
parseInput
Returns theImageTextInput
from theInput
.- Parameters:
input
- the input object- Returns:
- the
ImageTextInput
from 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
-