From debc4a621e086b7ee969b5ff73a66e996fd7b9a2 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 20:10:10 +0530 Subject: [PATCH 01/17] add new provider enum --- config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index 4d05472..7e81438 100644 --- a/config.yaml +++ b/config.yaml @@ -17,7 +17,7 @@ beckham: false export_fps: 0 # 0 is original video (or don't include the variable) gcloud_speedup: true # if true, will run through gcloud tts twice -# Provider enum: GCLOUD-1, AWS-2 +# Provider enum: GCLOUD-1, AWS-2, AWS_DEEPL-3 stt_provider: 1 translate_provider: 1 tts_provider: 1 From eb9ff926e7ce3955ec91923bf7e7316089b7c7a3 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 20:13:06 +0530 Subject: [PATCH 02/17] DeepL API --- src/constants/constants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/constants.py b/src/constants/constants.py index df14b3b..cb2d92c 100644 --- a/src/constants/constants.py +++ b/src/constants/constants.py @@ -44,6 +44,7 @@ def build_repo_path(): AWS_UPLOAD_BUCKET_URL = f"https://{AWS_UPLOAD_BUCKET_NAME}.s3.{AWS_REGION}.com" GCLOUD_UPLOAD_BUCKET_NAME = "" # TODO Must be filled in GCLOUD_UPLOAD_BUCKET_URL = "gs://" + GCLOUD_UPLOAD_BUCKET_NAME +DEEPL_API_KEY = "" # TODO Must be filled in EOS_PUNCTUATION = [".", "?", "!"] From 05ab9033129e10edd5bed9e7e715caf6d68c73e8 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 20:13:47 +0530 Subject: [PATCH 03/17] json for best voices --- best_voices.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 best_voices.json diff --git a/best_voices.json b/best_voices.json new file mode 100644 index 0000000..68b6324 --- /dev/null +++ b/best_voices.json @@ -0,0 +1,26 @@ +{ + "female": { + "AWS": { + "es-ES": "Conchita" + } + }, + "male": { + "AWS": { + "da-DK": "Mads", + "de-DE": "Hans", + "en-AU": "Russell", + "en-GB": "Brian", + "en-GB-WLS": "Geraint", + "en-US": "Matthew", + "es-ES": "Enrique", + "es-US": "Miguel", + "fr-FR": "Mathieu", + "is-IS": "Karl", + "it-IT": "Giorgio", + "ja-JP": "Takumi", + "hi-IN": "Aditi", + "pl-PL": "Jacek", + "pt-PT": "Cristiano" + } + } +} \ No newline at end of file From 97a1df3e88e62a10d2a9eafa5515226f6c189b1f Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 20:17:38 +0530 Subject: [PATCH 04/17] add deepL translator API --- src/api/translate/deepl_translate.py | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/api/translate/deepl_translate.py diff --git a/src/api/translate/deepl_translate.py b/src/api/translate/deepl_translate.py new file mode 100644 index 0000000..8a1dffe --- /dev/null +++ b/src/api/translate/deepl_translate.py @@ -0,0 +1,36 @@ +# deepl translate +import six +import requests +from constants.constants import DEEPL_API_KEY + + +def get_translation(text_to_translate, target_language): + """Translates text into the target language. + Target must be an ISO 639-1 language code. + See https://www.deepl.com/docs-api/other-functions/listing-supported-languages/ + """ + if isinstance(text_to_translate, six.binary_type): + text_to_translate = text_to_translate.decode("utf-8") + + translated_lst, error = [], [] + # List of required parameters for response. + try: + parameters = { + "text": text_to_translate, + "target_lang": target_language, + "auth_key": DEEPL_API_KEY, + } + # making request to deepl translation API. + # returns a JSON representation of the translations in the order the text parameters have been specified. + response = requests.get("https://api.deepl.com/v2/translate", params=parameters) + responses = response.json() + for item in responses.values(): + for key in item: + translated_lst.append(key["text"]) + except Exception as e: + error.append(str(e)) + + print("\n".join(error)) + + print(responses) + return translated_lst[0] From a8d8666bc7cd989c2d84dc959c03407f80e48eb7 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 20:23:46 +0530 Subject: [PATCH 05/17] fixes minor bugs(#L112); integrate deepL with AWS(tts, stt) --- src/client.py | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/client.py b/src/client.py index 5472edd..f7236d3 100644 --- a/src/client.py +++ b/src/client.py @@ -7,6 +7,7 @@ class Provider(enum.Enum): GCLOUD = 1 AWS = 2 + AWS_DEEPL = 3 class Client: @@ -45,6 +46,14 @@ def setup_clients(self): if self.tts_provider == Provider.AWS: from api.tts import aws_tts as tts + if self.stt_provider == Provider.AWS_DEEPL: + from api.storage import aws_storage as storage + from api.stt import aws_stt as stt + if self.translate_provider == Provider.AWS_DEEPL: + from api.translate import deepl_translate as translate + if self.tts_provider == Provider.AWS_DEEPL: + from api.tts import aws_tts as tts + self.storage = storage self.stt = stt self.translate = translate @@ -52,7 +61,8 @@ def setup_clients(self): self.storage_client = storage.get_client() self.stt_client = stt.get_client() - self.translate_client = translate.get_client() + if not self.translate_provider == Provider.AWS_DEEPL: + self.translate_client = translate.get_client() self.tts_client = tts.get_client() self.target_voices = {} @@ -72,9 +82,12 @@ def transcribe_sentences(self, locale): return api.stt.util.create_sentences_from_word_list(word_list, locale) def get_translation(self, original_text, target_language): - return self.translate.get_translation( - self.translate_client, original_text, target_language - ) + if not self.translate_provider == Provider.AWS_DEEPL: + return self.translate.get_translation( + self.translate_client, original_text, target_language + ) + else: + return self.translate.get_translation(original_text, target_language) def get_target_voice(self, locale, gender): response = self.tts.list_voices(self.tts_client, locale) @@ -119,9 +132,14 @@ def get_audio_chunk_for_sentence(self, text, locale, speedup=1.0): if update_best_voices == "y": self.save_best_voices() - return self.tts.get_audio_chunk_for_sentence( - self.tts_client, text, self.target_voices[locale], speedup=speedup - ) + if self.tts_provider == Provider.GCLOUD: + return self.tts.get_audio_chunk_for_sentence( + self.tts_client, text, self.target_voices[locale], speedup=speedup + ) + else: + return self.tts.get_audio_chunk_for_sentence( + self.tts_client, text, self.target_voices[locale] + ) # Returns a list of voices which match the gender of the client def get_all_matching_voices(self): From 1d119da0174e6e30ee9c04e0a168748d4d1fef24 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 20:25:09 +0530 Subject: [PATCH 06/17] test for deepL translator --- tests/test_deepl_translate.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_deepl_translate.py diff --git a/tests/test_deepl_translate.py b/tests/test_deepl_translate.py new file mode 100644 index 0000000..407a40b --- /dev/null +++ b/tests/test_deepl_translate.py @@ -0,0 +1,24 @@ +# This file should be used to test app credentials +# once it runs successfully, you can be sure that +# AWS with DeepL translation is set up correctly on this machine +import __init__ +from api.translate import deepl_translate as translate +from test_framework import test + + +def test_translation(): + result = translate.get_translation("Hello, there, Let's Play Soccer", "fr") + return test(result == "Bonjour à tous, Jouons au football", "translation") + + +def main(): + err = 0 + print("Test DeepL Translations") + err += test_translation() + print("Translation testing Done") + + return err + + +if __name__ == "__main__": + main() From 84b68843683e6a22b10654a93eedc3685d440b8e Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 20:29:39 +0530 Subject: [PATCH 07/17] delete best_voices.json --- best_voices.json | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 best_voices.json diff --git a/best_voices.json b/best_voices.json deleted file mode 100644 index 68b6324..0000000 --- a/best_voices.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "female": { - "AWS": { - "es-ES": "Conchita" - } - }, - "male": { - "AWS": { - "da-DK": "Mads", - "de-DE": "Hans", - "en-AU": "Russell", - "en-GB": "Brian", - "en-GB-WLS": "Geraint", - "en-US": "Matthew", - "es-ES": "Enrique", - "es-US": "Miguel", - "fr-FR": "Mathieu", - "is-IS": "Karl", - "it-IT": "Giorgio", - "ja-JP": "Takumi", - "hi-IN": "Aditi", - "pl-PL": "Jacek", - "pt-PT": "Cristiano" - } - } -} \ No newline at end of file From 53a77404df35a6b2b73c6a74a0e40d3f8747c408 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 20:36:05 +0530 Subject: [PATCH 08/17] link for aws supporting languages --- src/api/translate/aws_translate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/translate/aws_translate.py b/src/api/translate/aws_translate.py index 5b21a97..418ad3c 100644 --- a/src/api/translate/aws_translate.py +++ b/src/api/translate/aws_translate.py @@ -10,7 +10,7 @@ def get_client(): def get_translation(translate_client, text_to_translate, target_language): """Translates text into the target language. Target must be an ISO 639-1 language code. - See https://g.co/cloud/translate/v2/translate-reference#supported_languages + See https://docs.aws.amazon.com/translate/latest/dg/what-is.html#what-is-languages """ if isinstance(text_to_translate, six.binary_type): text_to_translate = text_to_translate.decode("utf-8") From 75b3929f4f061dc1c7ffb278967a3b30997eeb02 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 20:55:30 +0530 Subject: [PATCH 09/17] (#new) add deepl translator API --- src/api/translate/deepl_translate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/translate/deepl_translate.py b/src/api/translate/deepl_translate.py index 8a1dffe..cd5cbc9 100644 --- a/src/api/translate/deepl_translate.py +++ b/src/api/translate/deepl_translate.py @@ -21,7 +21,7 @@ def get_translation(text_to_translate, target_language): "auth_key": DEEPL_API_KEY, } # making request to deepl translation API. - # returns a JSON representation of the translations in the order the text parameters have been specified. + # returns a JSON representation of the translation in the order the text parameters have been specified. response = requests.get("https://api.deepl.com/v2/translate", params=parameters) responses = response.json() for item in responses.values(): From ab809aad50837dd032667b49295ab338d28405e7 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Sun, 9 Aug 2020 21:50:49 +0530 Subject: [PATCH 10/17] test for deepl translator --- tests/run_tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index fa0bfa4..63f4691 100644 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -1,5 +1,5 @@ import sys -import test_sentence, test_project, test_stt, test_translate, test_tts +import test_sentence, test_project, test_stt, test_translate, test_tts, test_deepl_translate # runs all the tests we have, should exit with 0 if __name__ == "__main__": @@ -9,4 +9,5 @@ err += test_stt.main() err += test_translate.main() err += test_tts.main() + err += test_deepl_translate.main() sys.exit(err) From d06f4556fdc3f43544253607a292de6c8f364490 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Tue, 11 Aug 2020 03:29:16 +0530 Subject: [PATCH 11/17] added DeepL API documentation; extend aws cli setup on linux OS --- docs/aws_setup_steps.md | 32 +++++++++++++++++++++++++++----- docs/deepl_setup_steps.md | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 docs/deepl_setup_steps.md diff --git a/docs/aws_setup_steps.md b/docs/aws_setup_steps.md index db8f4a5..77f08af 100644 --- a/docs/aws_setup_steps.md +++ b/docs/aws_setup_steps.md @@ -1,11 +1,33 @@ -Create AWS account. Get Security Access Keys from security info page +## AWS Setup -Run +Create AWS account. Get Security Access Keys from security info page and follow the below commands. + +#### Setup Run on OS::Mac ``` curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" sudo installer -pkg AWSCLIV2.pkg -target / ``` Check with `aws` to see if the install succeeded. -Run `aws configure` to begin configuration. -Set Access key and secret key -Optionally set us-west-2 and json as the other parameters +- Run `aws configure` to begin configuration. +- Set Access key and secret key +- Optionally set us-west-2 and json as the other parameters + + +#### Setup Run on OS::Linux x86(64bit) + +This area portrays how to install the AWS CLI version 2 on Linux. The AWS CLI version 2 has no dependencies on other Python packages. It has a self-contained, embedded copy of Python included in the installer. +``` +curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" +unzip awscliv2.zip +sudo ./aws/install +``` +(Optional) Downloading from the URL - o download the installer with your browser, use the following URL: Click [(Download here)](https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip). You can verify the integrity and authenticity of your downloaded installation file before you extract (unzip) the package. + +Confirm your installation +``` +aws --version +``` +Check with `aws` to see if the install succeeded. +- Run `aws configure` to begin configuration. +- Set Access key and secret key +- Optionally set us-west-2/east-2 and json as the other parameters diff --git a/docs/deepl_setup_steps.md b/docs/deepl_setup_steps.md new file mode 100644 index 0000000..40980dd --- /dev/null +++ b/docs/deepl_setup_steps.md @@ -0,0 +1,27 @@ +## DeepL Translator + +- Create an account in [(DeepL Pro)](https://www.deepl.com/pro?cta=menu-login-signup). +- For Free Trial (Click `Start Free Trial` and Select an Plan), follow the steps andelect the plan for one month. +- Once you verify your address and other details, Navigate to dashboard for DeepL API Key. +- Remember your IBM API key (keep it safe!) and use URL [(https://api.deepl.com/v2/translate)](https://api.deepl.com/v2/translate). +- With this API key you can create a wrapper fucntion. +- API call will be through ```curl/network requests```. + +EXAMPLE REQUEST +``` +curl https://api.deepl.com/v2/translate \ + -d auth_key=[yourAuthKey] \ + -d "text=Hello, world" \ + -d "target_lang=DE" +``` +EXAMPLE RESPONSE +JSON Representation +``` +{ + "translations": [{ + "detected_source_language":"EN", + "text":"Hallo, Welt!" + }] +} +``` +For more details about DeepL translator request, response, authentication, etc. Refer to [(https://www.deepl.com/docs-api/)](https://www.deepl.com/docs-api/accessing-the-api/authentication/) \ No newline at end of file From 6241916eca8d676243d14d000ea1e6923bc0d440 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Tue, 11 Aug 2020 03:35:07 +0530 Subject: [PATCH 12/17] modified test_config with AWS_DeepL provider --- tests/test_config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_config.yaml b/tests/test_config.yaml index e56ad39..0d874e0 100644 --- a/tests/test_config.yaml +++ b/tests/test_config.yaml @@ -17,10 +17,10 @@ development_dir: media/test/dev # Video flags export_fps: 1 -# Provider enum: GCLOUD-1, AWS-2 -stt_provider: 1 -translate_provider: 1 -tts_provider: 1 +# Provider enum: GCLOUD-1, AWS-2, DEEPL_AWS-3 +stt_provider: 3 +translate_provider: 3 +tts_provider: 3 use_best_voices: true best_voices_file: best_voices.json From a7187b65e3d16673aa21eacb709d5ea157011c85 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Tue, 11 Aug 2020 03:46:15 +0530 Subject: [PATCH 13/17] added the DeepL API documentation --- docs/deepl_setup_steps.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deepl_setup_steps.md b/docs/deepl_setup_steps.md index 40980dd..f0d084c 100644 --- a/docs/deepl_setup_steps.md +++ b/docs/deepl_setup_steps.md @@ -3,7 +3,7 @@ - Create an account in [(DeepL Pro)](https://www.deepl.com/pro?cta=menu-login-signup). - For Free Trial (Click `Start Free Trial` and Select an Plan), follow the steps andelect the plan for one month. - Once you verify your address and other details, Navigate to dashboard for DeepL API Key. -- Remember your IBM API key (keep it safe!) and use URL [(https://api.deepl.com/v2/translate)](https://api.deepl.com/v2/translate). +- Remember your DeepL API key (keep it safe!) and use URL [(https://api.deepl.com/v2/translate)](https://api.deepl.com/v2/translate). - With this API key you can create a wrapper fucntion. - API call will be through ```curl/network requests```. From b1bbb5b2829f6e4c2967541651ecf5587a38594a Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Wed, 12 Aug 2020 03:39:43 +0530 Subject: [PATCH 14/17] update rubberband setup on Linux; update serivice enum --- README.md | 3 ++- config.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 36ef3cf..a231360 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ Most important: `pip install -r docs/requirements.txt` Also install rubberband -`brew install rubberband` +macOS: `brew install rubberband` +Linux: `sudo apt-get install -y rubberband-cli` And follow the instructions in `docs/` for `aws` and `gcloud` integration. Then make sure to setup the names of the s3 or gcloud bucket you will store your audio in. diff --git a/config.yaml b/config.yaml index 7e81438..60865b5 100644 --- a/config.yaml +++ b/config.yaml @@ -17,7 +17,7 @@ beckham: false export_fps: 0 # 0 is original video (or don't include the variable) gcloud_speedup: true # if true, will run through gcloud tts twice -# Provider enum: GCLOUD-1, AWS-2, AWS_DEEPL-3 +# Provider enum: GCLOUD-1, AWS-2, DEEPL-3 stt_provider: 1 translate_provider: 1 tts_provider: 1 From ca62cbccab33fbbce75a498405c6fef39ab68358 Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Wed, 12 Aug 2020 03:44:23 +0530 Subject: [PATCH 15/17] fix: Add get_config() and client parameters; modified test for deepl translator --- src/api/translate/deepl_translate.py | 8 +++++++- tests/test_deepl_translate.py | 14 +++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/api/translate/deepl_translate.py b/src/api/translate/deepl_translate.py index cd5cbc9..57e2476 100644 --- a/src/api/translate/deepl_translate.py +++ b/src/api/translate/deepl_translate.py @@ -4,7 +4,13 @@ from constants.constants import DEEPL_API_KEY -def get_translation(text_to_translate, target_language): +# returns None +def get_client(): + print("Using DeepL for translation client") + return None + + +def get_translation(translate_client, text_to_translate, target_language): """Translates text into the target language. Target must be an ISO 639-1 language code. See https://www.deepl.com/docs-api/other-functions/listing-supported-languages/ diff --git a/tests/test_deepl_translate.py b/tests/test_deepl_translate.py index 407a40b..9fe4906 100644 --- a/tests/test_deepl_translate.py +++ b/tests/test_deepl_translate.py @@ -1,22 +1,22 @@ # This file should be used to test app credentials # once it runs successfully, you can be sure that -# AWS with DeepL translation is set up correctly on this machine +# DeepL translation is set up correctly on this machine import __init__ from api.translate import deepl_translate as translate from test_framework import test -def test_translation(): - result = translate.get_translation("Hello, there, Let's Play Soccer", "fr") - return test(result == "Bonjour à tous, Jouons au football", "translation") +def test_translation(client): + result = translate.get_translation(client, "Hello, there, Let's Play Soccer", "fr") + return test(result.lower() == "Bonjour à tous, Jouons au football", "translation") def main(): err = 0 print("Test DeepL Translations") - err += test_translation() - print("Translation testing Done") - + client = translate.get_client() + err += test_translation(client) + print("Translation testing done") return err From fda8243ed7be2f711695f3d465222017df0866fa Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Wed, 12 Aug 2020 03:47:26 +0530 Subject: [PATCH 16/17] fix: update DeepL provider enum and locales --- tests/test_config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_config.yaml b/tests/test_config.yaml index 0d874e0..b5d4990 100644 --- a/tests/test_config.yaml +++ b/tests/test_config.yaml @@ -8,7 +8,7 @@ gender: 1 # using one language as a test target_locales: -- fr-FR +- de-DE # Optional params production_dir: media/test/prod @@ -17,10 +17,10 @@ development_dir: media/test/dev # Video flags export_fps: 1 -# Provider enum: GCLOUD-1, AWS-2, DEEPL_AWS-3 -stt_provider: 3 +# Provider enum: GCLOUD-1, AWS-2, DEEPL-3 +stt_provider: 2 translate_provider: 3 -tts_provider: 3 +tts_provider: 2 use_best_voices: true best_voices_file: best_voices.json From c08fb4f94b7359210468bc627e28ee76a656fbee Mon Sep 17 00:00:00 2001 From: Arunav Shandilya Date: Wed, 12 Aug 2020 03:55:28 +0530 Subject: [PATCH 17/17] fix: Detached AWS and DeepL providers --- src/client.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/client.py b/src/client.py index f7236d3..9efb71b 100644 --- a/src/client.py +++ b/src/client.py @@ -7,7 +7,7 @@ class Provider(enum.Enum): GCLOUD = 1 AWS = 2 - AWS_DEEPL = 3 + DEEPL = 3 class Client: @@ -46,13 +46,8 @@ def setup_clients(self): if self.tts_provider == Provider.AWS: from api.tts import aws_tts as tts - if self.stt_provider == Provider.AWS_DEEPL: - from api.storage import aws_storage as storage - from api.stt import aws_stt as stt - if self.translate_provider == Provider.AWS_DEEPL: + if self.translate_provider == Provider.DEEPL: from api.translate import deepl_translate as translate - if self.tts_provider == Provider.AWS_DEEPL: - from api.tts import aws_tts as tts self.storage = storage self.stt = stt @@ -61,8 +56,7 @@ def setup_clients(self): self.storage_client = storage.get_client() self.stt_client = stt.get_client() - if not self.translate_provider == Provider.AWS_DEEPL: - self.translate_client = translate.get_client() + self.translate_client = translate.get_client() self.tts_client = tts.get_client() self.target_voices = {} @@ -82,12 +76,9 @@ def transcribe_sentences(self, locale): return api.stt.util.create_sentences_from_word_list(word_list, locale) def get_translation(self, original_text, target_language): - if not self.translate_provider == Provider.AWS_DEEPL: - return self.translate.get_translation( - self.translate_client, original_text, target_language - ) - else: - return self.translate.get_translation(original_text, target_language) + return self.translate.get_translation( + self.translate_client, original_text, target_language + ) def get_target_voice(self, locale, gender): response = self.tts.list_voices(self.tts_client, locale)