Skip to content

Commit

Permalink
Fix typo and remove is ascii check
Browse files Browse the repository at this point in the history
  • Loading branch information
danylo-boiko committed Oct 15, 2024
1 parent 9db4c75 commit 69de98a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/backend/services/synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def synthesize(text: str) -> bytes:
"api_key": Settings().google_cloud.api_key
})

langauge = detect_language(text)
language = detect_language(text)

response = client.synthesize_speech(
input=SynthesisInput(text=text),
voice=VoiceSelectionParams(language_code=langauge),
voice=VoiceSelectionParams(language_code=language),
audio_config=AudioConfig(audio_encoding=AudioEncoding.MP3)
)

Expand All @@ -45,9 +45,6 @@ def detect_language(text: str) -> str:
Returns:
str: The language code of the detected language (e.g., 'en', 'es').
"""
if text.isascii():
return "en"

client = build("translate", "v2", developerKey=Settings().google_cloud.api_key)

response = client.detections().list(q=text).execute()
Expand Down

0 comments on commit 69de98a

Please sign in to comment.