Commit
·
b1da8e3
1
Parent(s):
83d5183
Rectify single_detection in text_to_tgt
Browse files- app.py +5 -5
- backend/text_to_tgt.py +1 -1
app.py
CHANGED
|
@@ -22,11 +22,11 @@ txt_interface = gr.Interface(
|
|
| 22 |
title=heading_txt,
|
| 23 |
description=description_txt,
|
| 24 |
examples=[
|
| 25 |
-
["Bonjour, comment ça va ?"],
|
| 26 |
-
["Привет, как дела?"],
|
| 27 |
-
["Hola, ¿cómo estás?"],
|
| 28 |
-
["
|
| 29 |
-
["Guten Tag! Wie geht's dir?"]
|
| 30 |
]
|
| 31 |
)
|
| 32 |
|
|
|
|
| 22 |
title=heading_txt,
|
| 23 |
description=description_txt,
|
| 24 |
examples=[
|
| 25 |
+
["Bonjour, comment ça va ?", "Hindi"],
|
| 26 |
+
["Привет, как дела?", "English"],
|
| 27 |
+
["Hola, ¿cómo estás?", "Odia (Oriya)"],
|
| 28 |
+
["你好,你怎么样", "English"],
|
| 29 |
+
["Guten Tag! Wie geht's dir?", "English"]
|
| 30 |
]
|
| 31 |
)
|
| 32 |
|
backend/text_to_tgt.py
CHANGED
|
@@ -9,7 +9,7 @@ lang_detect_key = os.getenv("detect_language_api_key")
|
|
| 9 |
|
| 10 |
def src_txt_to_eng_translator(input_text, target_lang = 'English'):
|
| 11 |
target_lang_code = formatted_languages.get(target_lang, 'en')
|
| 12 |
-
src_lang_code = detection.
|
| 13 |
src_lang = formatted_codes.get(src_lang_code, 'Source language not detected')
|
| 14 |
translated = GoogleTranslator(source='auto', target=target_lang_code).translate(input_text)
|
| 15 |
return translated, src_lang
|
|
|
|
| 9 |
|
| 10 |
def src_txt_to_eng_translator(input_text, target_lang = 'English'):
|
| 11 |
target_lang_code = formatted_languages.get(target_lang, 'en')
|
| 12 |
+
src_lang_code = detection.single_detecttion(input_text, api_key = lang_detect_key)
|
| 13 |
src_lang = formatted_codes.get(src_lang_code, 'Source language not detected')
|
| 14 |
translated = GoogleTranslator(source='auto', target=target_lang_code).translate(input_text)
|
| 15 |
return translated, src_lang
|