Skip to content

TTS-Translator is a Docker image that contains an API for translating text and converting text to speech. It also provides the functionality to combine both actions to provide text-to-speech translation.

License

Notifications You must be signed in to change notification settings

tmcx/tts-translator

Repository files navigation

Description

TTS-Translator is a Docker image that contains an API for translating text and converting text to speech. It also provides the functionality to combine both actions to provide text-to-speech translation.

Environment Variables

  • LT_LOAD_ONLY: Defines the languages to be installed.

    • Default: "en,es".
    • Available: sq(Albanian), de(German), ar(Arabic), az(Azerbaijani), bn(Bengali), bg(Bulgarian), ca(Catalan), zh(Chinese), zt(Chinese (traditional)), cs(Czech), da(Danish), nl(Dutch), en(English), eo(Esperanto), et(Estonian), fi(Finnish), fr(French), el(Greek), he(Hebrew), hi(Hindi), hu(Hungarian), id(Indonesian), ga(Irish), it(Italian), ja(Japanese), ko(Korean), lv(Latvian), lt(Lithuanian), ms(Malay), nb(Norwegian), fa(Persian), pl(Polish), pt(Portuguese), ro(Romanian), ru(Russian), sr(Serbian), sk(Slovak), sl(Slovenian), es(Spanish), sv(Swedish), tl(Tagalog), th(Thai), tr(Turkish), uk(Ukrainian), ur(Urdu), vi(Vietnamese).
    • All unselected languages ​​will not work in the API.
  • API_PORT: Defines the port of the API.

    • Default: "8080"

Features

  • Text translation.
  • Text-to-speech conversion.
  • Text-to-speech translation.

Endpoints

  • POST /tts: Translates and/or transforms to text-to-speech.
    • HTTP Body:
    {
        "text": "Hello world!",           // [Required] Text to use
        "voice": {                        // [Optional] Voice configuration
            "name" : "es-AR-TomasNeural", // TTS voice. To list it use /tts/voices endpoint.
            "volume": -50,                 // Voice volume
            "pitch": -10,                 // Voice pitch
            "rate": -10                   // Voice rate
        },
        "translate": {                    // [Optional] Translation configuration
            "from": "en",                 // Source language
            "to": "es"                    // Target language
        }
    }
  • GET /tts/voices: Retrieves the voices available for text-to-speech.
  • POST /translate: Translates text.
    • HTTP Body:
    {
        "text": "Hello world!",           // [Required] Text to use
        "from": "en",                     // [Required] Source language. To list it use /translate/languages endpoint.
        "to": "es"                        // [Required] Target language. To list it use /translate/languages endpoint.
    }
  • GET /translate/languages: Retrieves the languages available for translate.

Usage

To run this Docker image, you can use the following command:

docker run -d -e LT_LOAD_ONLY="en,es" -e API_PORT="8080" -p 8080:8080 tmcx/tts-translator:latest

Author

TMCX

Repository

The source code of this project is available on GitHub.

License

This project is licensed under the LGPL-3 License for commercial use without the obligation to share the source code.

About

TTS-Translator is a Docker image that contains an API for translating text and converting text to speech. It also provides the functionality to combine both actions to provide text-to-speech translation.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published