Class VisionLanguageInput

java.lang.Object
ai.djl.modality.cv.VisionLanguageInput

public class VisionLanguageInput extends Object
The input container for a vision language model.
  • Constructor Details

    • VisionLanguageInput

      public VisionLanguageInput(Image image, String text)
      Constructs a new ImageTextInput instance.
      Parameters:
      image - the image input
      text - the prompt
    • VisionLanguageInput

      public VisionLanguageInput(Image image, String[] candidates)
      Constructs a new ImageTextInput instance.
      Parameters:
      image - the image input
      candidates - the candidate labels
    • VisionLanguageInput

      public VisionLanguageInput(Image image, String text, String[] candidates, String hypothesisTemplate)
      Constructs a new ImageTextInput instance.
      Parameters:
      image - the image input
      text - the prompt
      candidates - the candidate labels
      hypothesisTemplate - the hypothesis template
  • Method Details

    • parseInput

      public static VisionLanguageInput parseInput(Input input) throws TranslateException, IOException
      Returns the ImageTextInput from the Input.
      Parameters:
      input - the input object
      Returns:
      the ImageTextInput from the Input
      Throws:
      TranslateException - if the input is invalid
      IOException - if failed to load image
    • getImage

      public Image getImage()
      Returns the image input.
      Returns:
      the image input
    • setImage

      public void setImage(Image image)
      Sets the image input.
      Parameters:
      image - the image input
    • getText

      public String getText()
      Returns the prompt text.
      Returns:
      the prompt text
    • setText

      public void setText(String text)
      Sets the prompt text.
      Parameters:
      text - the prompt text
    • getCandidates

      public String[] getCandidates()
      Returns the candidate labels.
      Returns:
      the candidate labels
    • setCandidates

      public void setCandidates(String[] candidates)
      Sets the candidate labels.
      Parameters:
      candidates - the candidate labels
    • getHypothesisTemplate

      public String getHypothesisTemplate()
      Returns the hypothesis template.
      Returns:
      the hypothesis template
    • setHypothesisTemplate

      public void setHypothesisTemplate(String hypothesisTemplate)
      Sets the hypothesis template.
      Parameters:
      hypothesisTemplate - the hypothesis template