Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 758 Bytes

File metadata and controls

26 lines (17 loc) · 758 Bytes

Cloudflare Workers AI Translate

using Cloudflare Workers AI using the m2m100-1.2b model to translate text.

installation and usage

installation:

npm i
npm run deploy

usage:

curl -d '{"text": "hey, how is it going?", "input": "english", "output": "german"}' -H 'content-type: application/json' https://translate.abracadabra.workers.dev

output: {"input":"english","output":"german","original_text":"hey, how is it going?","translated_text":"Hey, wie geht es?"}

or, just get the translated text using jq:

curl -s -d '{"text": "hey, how is it going?", "input": "english", "output": "german"}' -H 'content-type: application/json' https://translate.abracadabra.workers.dev | jq -r .translated_text