Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -79,8 +79,8 @@ def batch_translate(input_sentences, src_lang, tgt_lang, model, tokenizer, ip):
|
|
| 79 |
return translations
|
| 80 |
|
| 81 |
# Initialize IndicTrans2
|
| 82 |
-
|
| 83 |
-
|
| 84 |
ip = IndicProcessor(inference=True)
|
| 85 |
|
| 86 |
# ---- Gradio Function ----
|
|
@@ -99,8 +99,8 @@ def transcribe_and_translate(audio):
|
|
| 99 |
# Translation
|
| 100 |
en_sents = [malayalam_text]
|
| 101 |
src_lang, tgt_lang = "mal_Mlym", "eng_Latn"
|
| 102 |
-
translations = batch_translate(en_sents, src_lang, tgt_lang,
|
| 103 |
-
|
| 104 |
return malayalam_text, translations[0]
|
| 105 |
|
| 106 |
# ---- Gradio Interface ----
|
|
|
|
| 79 |
return translations
|
| 80 |
|
| 81 |
# Initialize IndicTrans2
|
| 82 |
+
indic_en_ckpt_dir = "ai4bharat/indictrans2-indic-en-1B"
|
| 83 |
+
indic_en_tokenizer, indic_en_model = initialize_model_and_tokenizer(indic_en_ckpt_dir, quantization)
|
| 84 |
ip = IndicProcessor(inference=True)
|
| 85 |
|
| 86 |
# ---- Gradio Function ----
|
|
|
|
| 99 |
# Translation
|
| 100 |
en_sents = [malayalam_text]
|
| 101 |
src_lang, tgt_lang = "mal_Mlym", "eng_Latn"
|
| 102 |
+
translations = batch_translate(en_sents, src_lang, tgt_lang, indic_en_model, indic_en_tokenizer, ip)
|
| 103 |
+
|
| 104 |
return malayalam_text, translations[0]
|
| 105 |
|
| 106 |
# ---- Gradio Interface ----
|