The translation function is realized by passing parameters through the API, the steps are as follows:
- Setting the task type: Add to the request
task=translate
Parameters. - Specify target language: By
language=en
(or other language code) defines the output language. - Send audio data: POST as binary to the worker URL of the
/raw
Interface.
Example cURL request:
curl -X POST "https://whispercloudflare.tchepai.com/raw?task=translate&language=en"
-H "Content-Type: application/octet-stream"
--data-binary "@audio.mp3"
The return result is the translated text and timestamp (in JSON format).
This answer comes from the articleWhisper on Cloudflare AI: a free tool to convert audio to text and generate subtitlesThe