Skip to content

Commit

Permalink
fix transliteration
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Jun 26, 2024
1 parent c7a7136 commit 7ceef32
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions daras_ai_v2/asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,7 @@ def run_google_translate(
if not target_language:
raise UserError(f"Unsupported target language: {target_language!r}")

# if the language supports transliteration, we should check if the script is Latin
if source_language and source_language not in TRANSLITERATION_SUPPORTED:
if source_language:
language_codes = [source_language] * len(texts)
else:
translate_client = translate.Client()
Expand All @@ -592,11 +591,8 @@ def _translate_text(
target_language: str,
glossary_url: str | None,
) -> str:
is_romanized = source_language.endswith("-Latn")
source_language = source_language.replace("-Latn", "")
enable_transliteration = (
is_romanized and source_language in TRANSLITERATION_SUPPORTED
)
enable_transliteration = source_language in TRANSLITERATION_SUPPORTED

# prevent incorrect API calls
if not text or source_language == target_language or source_language == "und":
Expand Down

0 comments on commit 7ceef32

Please sign in to comment.