←back to thread

Web Translator API

(developer.mozilla.org)
97 points kozika | 2 comments | | HN request time: 0s | source
Show context
sfmz ◴[] No.44376080[source]
https://developer.chrome.com/docs/ai/translator-api

const translator = await Translator.create({ sourceLanguage: 'en', targetLanguage: 'fr', });

await translator.translate('Where is the next bus stop, please?');

replies(1): >>44378311 #
ks2048 ◴[] No.44378311[source]
So, this is Google Translate built running locally in Chrome? I wonder if it is a small/degraded model or limited languages? Otherwise, how is it not a simple way around the paid Google API?
replies(5): >>44378361 #>>44378552 #>>44379184 #>>44381572 #>>44381935 #
1. sfmz ◴[] No.44378552[source]
There's already ways to do translation locally in javascript with neural-nets running in WASM, this is just more convenient.

https://huggingface.co/Xenova/nllb-200-distilled-600M

replies(1): >>44384757 #
2. vitonsky ◴[] No.44384757[source]
I tried to use this model in my package with translators kit https://github.com/translate-tools/core/pull/112

It runs very slow. Test case that run translation for text in 3k chars multiple times, takes about 30 seconds for google translator, but more than 10 minutes for `nllb-200-distilled-600M`.

Text sample: https://github.com/translate-tools/core/pull/112/files#diff-...

My tests runs on nodejs, it looks in browser it have no chance for real world use