[Editor] Add the possibility to query some ML stuff to guess an alt text for an image

It's only for an experimental purpose.
This commit is contained in:
Calixte Denizet 2024-02-20 09:49:20 +01:00
parent 99fa713fba
commit 46416bb131
11 changed files with 102 additions and 6 deletions

View file

@ -563,6 +563,8 @@ class AnnotationEditorUIManager {
#mainHighlightColorPicker = null;
#mlManager = null;
#mode = AnnotationEditorType.NONE;
#selectedEditors = new Set();
@ -749,7 +751,8 @@ class AnnotationEditorUIManager {
eventBus,
pdfDocument,
pageColors,
highlightColors
highlightColors,
mlManager
) {
this.#container = container;
this.#viewer = viewer;
@ -763,6 +766,7 @@ class AnnotationEditorUIManager {
this.#filterFactory = pdfDocument.filterFactory;
this.#pageColors = pageColors;
this.#highlightColors = highlightColors || null;
this.#mlManager = mlManager || null;
this.viewParameters = {
realScale: PixelsPerInch.PDF_TO_CSS_UNITS,
rotation: 0,
@ -797,6 +801,14 @@ class AnnotationEditorUIManager {
}
}
async mlGuess(data) {
return this.#mlManager?.guess(data) || null;
}
get hasMLManager() {
return !!this.#mlManager;
}
get hcmFilter() {
return shadow(
this,