CodBi
    Preparing search index...

    Maintainer: Callari, Salvatore (Salvatore.Callari@Ansbach.de)

    Index

    Constructors

    Methods

    Constructors

    Methods

    • This functionality processes uploaded images using a Donut AI-Model running on the DJL ONNX-Engine to answer questions about documents. As soon as the file(s) selected changes the AI is contacted via AJAX and the questions are answered. Nothing happens if no file is selected.

      PDF Support: The functionality automatically detects PDF files and processes them accordingly:

      • If PDF contains mainly text, the text is rendered to an image before sending to AI
      • If PDF contains images (scanned documents), those images are extracted and sent to AI
      • Multiple files can be selected, mixing PDFs and images

      Image Orientation: The Donut model is sensitive to image rotation. There are two ways to provide orientation of the image to process:

      1. Manual Rotation (Priority): Add a data-cb-Rotate attribute to the input element:

        • data-cb-Rotate="90" - Rotate image 90° clockwise
        • data-cb-Rotate="180" - Rotate image 180°
        • data-cb-Rotate="270" - Rotate image 270° clockwise (90° counter-clockwise)
      2. Automatic Detection (Fallback): If no data-cb-Rotate attribute is provided AND the Tesseract OCR engine is active (OCR is set in Active_AI plugin property), the system will automatically detect and correct image orientation using Tesseract's OSD (Orientation and Script Detection). Hint: If you experience wrong results on images taken with an iPhone, consider enabling OCR for automatic rotation correction. Since some iPhones don't visibly show when they rotate an image that is taken by camera and directly imported, like when selecting file and taking a photo as the selection.

      3. No Rotation: If data-cb-Rotate is not provided and OCR is not set in Active_AI plugin property, images are processed as-is leading to potential wrong results with images that are rotated.

      • maxPages: Optional number limiting how many pages from a PDF are processed and sent to the AI. Useful for large PDFs to avoid overwhelming the AI or hitting processing limits. If not specified or set to 0, all pages are processed. Example: maxPages: 5 will only process the first 5 pages of any PDF. Defaults to 5.
      • Rotate: Optional attribute on the input element to specify image rotation (see above), either "90", "180", or "270". In a multi-file upload or with a PDF that contains multiple images, this rotation is applied to all files.

      Questions are acquired from DOM elements within the parent.parent container of the HTMLInputElement toProcess that're tagged with the class AI_ONNX_DONUT_QA_Question. Each such element should have:

      • An id attribute (used as the question key)
      • A data-cb-Question attribute (contains the question text)

      Parameters

      • toLoad: { [key: string]: unknown }

        Provided by the CodBi.

      • toProcess: Element

        Provided by the CodBi.

      Returns void