/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththisfile,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
function ensureInferenceEnabled() { if (extensionInferenceEnabled && browserInferenceEnable) { return;
} thrownew ExtensionError(
`Trial ML API is disabled. This API is only available when "${PREF_EXTENSIONS_ML_ENABLED}" and ${PREF_BROWSER_ML_ENABLE}" preferences are set to true.`
);
}
var { ExtensionError } = ExtensionUtils;
// We could have that list in remote settings as well const SUPPORTED_TASKS = [ "text-classification", "token-classification", "question-answering", "fill-mask", "summarization", "translation", "text2text-generation", "text-generation", "text-to-speech", "text-to-audio", "zero-shot-classification", "image-to-text", "image-classification", "image-segmentation", "zero-shot-image-classification", "object-detection", "zero-shot-object-detection", "document-question-answering", "image-to-image", "depth-estimation", "feature-extraction", "image-feature-extraction",
];
const ENGINE_EVENT = "MLEngine:progress"; const modelHub = new ModelHub();
if (!SUPPORTED_TASKS.includes(request.taskName)) { thrownew ExtensionError(`Unsupported task ${request.taskName}`);
} // The request is converted in a PipelineOptions object. // That constructor checks for any value issue and will error out. // We can catch it here to provide nice error messages try { this.#pipelineOptions = new PipelineOptions(request);
await this.#createEngine(this.#pipelineOptions);
} catch (error) { thrownew ExtensionError(error.message);
}
},
/** *Registersaneventlistenerforprogresseventsduringpipelineexecution. * *@type{EventManager}
*/
onProgress: new EventManager({
context,
name: "trial.ml.onProgress",
register: fire => { const callback = (_evtName, progressData) => { // NOTE: as long as these events are only informational, we don't // need to gate the event callback with the `ensureInferenceEnabled()` // check, the events would only be sent for work that did technically // start before the API was globally disabled.
fire.async(progressData);
}; this.extension.on(ENGINE_EVENT, callback); return () => { this.extension.off(ENGINE_EVENT, callback);
};
},
}).api(),
},
},
};
}
}
this.trial_ml = TrialML;
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-08-25)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.