mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 01:35:43 +02:00
[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:
parent
99fa713fba
commit
46416bb131
11 changed files with 102 additions and 6 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue