←back to thread

Web Translator API

(developer.mozilla.org)
97 points kozika | 2 comments | | HN request time: 0.419s | 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 #
ameliaquining ◴[] No.44379184[source]
The article explains that this feature uses a small (up to 22 GB) language model that runs on-device.

That said, the "simple way around the paid API" problem is something Google has to deal with anyway, because there are a bunch of ways to use Google Translate without paying for it (e.g., the translate.google.com web UI, or the non-JavaScript-exposed "Translate to [language]" feature built into Chrome), and any action that can be taken by a human can in principle also be taken by a script. The only thing to do about it is use secret-sauce server-side abuse detection to block as much of this activity as they can; they can't get all of it but they can get enough to push enough people onto the paid API that the economics pencil out.

replies(1): >>44379749 #
jannes ◴[] No.44379749[source]
So installing Chrome is going to require 22 GB of disk space now?
replies(2): >>44379776 #>>44388237 #
ks2048 ◴[] No.44379776[source]
It only installs models that explicitly downloaded via this API, it seems.

Also, it says to have 22 GB free, but below (under "Note"...), it says the model takes "around a couple of GB".

replies(1): >>44379798 #
cj ◴[] No.44379798[source]
Does the API trigger the download automatically, or does it ask for user permission?

(Answered my own question): Doesn't look like it requires the user's permission. Upon first use, the model will start downloading. The user has to wait for the download to finish before the API will work. That could take hours for 22gb.

I presume this can't work on mobile?

https://developer.mozilla.org/en-US/docs/Web/API/Translator_...

replies(1): >>44379956 #
ameliaquining ◴[] No.44379956[source]
The article indicates that it will only download the model over an unmetered connection, e.g., while the phone is connected to wifi.
replies(1): >>44385408 #
1. djhn ◴[] No.44385408[source]
Seems very backwards for markets where wired/wifi connections at home are nonexistant, 4g/5g is already unmetered and phones are the wifi you connect your devices to.
replies(1): >>44392160 #
2. ameliaquining ◴[] No.44392160[source]
If you have an unlimited data plan then Android counts that as an unmetered connection and Chrome will download the model over it.