Update app.py
Browse files
app.py
CHANGED
@@ -20,23 +20,28 @@ if text:
|
|
20 |
**model_inputs,
|
21 |
forced_bos_token_id=tokenizer_translation.lang_code_to_id["hi_IN"]
|
22 |
)
|
|
|
|
|
23 |
elif lg==2:
|
24 |
generated_tokens = model_translation.generate(
|
25 |
**model_inputs,
|
26 |
forced_bos_token_id=tokenizer_translation.lang_code_to_id["te_IN"]
|
27 |
)
|
|
|
|
|
28 |
elif lg==3:
|
29 |
generated_tokens = model_translation.generate(
|
30 |
**model_inputs,
|
31 |
forced_bos_token_id=tokenizer_translation.lang_code_to_id["gu_IN"]
|
32 |
)
|
|
|
|
|
33 |
elif lg==4:
|
34 |
generated_tokens = model_translation.generate(
|
35 |
**model_inputs,
|
36 |
forced_bos_token_id=tokenizer_translation.lang_code_to_id["bn_IN"]
|
37 |
)
|
|
|
|
|
38 |
else:
|
39 |
-
|
40 |
-
|
41 |
-
translation = tokenizer_translation.batch_decode(generated_tokens, skip_special_tokens=True)
|
42 |
-
st.json(translation)
|
|
|
20 |
**model_inputs,
|
21 |
forced_bos_token_id=tokenizer_translation.lang_code_to_id["hi_IN"]
|
22 |
)
|
23 |
+
translation = tokenizer_translation.batch_decode(generated_tokens, skip_special_tokens=True)
|
24 |
+
st.json(translation)
|
25 |
elif lg==2:
|
26 |
generated_tokens = model_translation.generate(
|
27 |
**model_inputs,
|
28 |
forced_bos_token_id=tokenizer_translation.lang_code_to_id["te_IN"]
|
29 |
)
|
30 |
+
translation = tokenizer_translation.batch_decode(generated_tokens, skip_special_tokens=True)
|
31 |
+
st.json(translation)
|
32 |
elif lg==3:
|
33 |
generated_tokens = model_translation.generate(
|
34 |
**model_inputs,
|
35 |
forced_bos_token_id=tokenizer_translation.lang_code_to_id["gu_IN"]
|
36 |
)
|
37 |
+
translation = tokenizer_translation.batch_decode(generated_tokens, skip_special_tokens=True)
|
38 |
+
st.json(translation)
|
39 |
elif lg==4:
|
40 |
generated_tokens = model_translation.generate(
|
41 |
**model_inputs,
|
42 |
forced_bos_token_id=tokenizer_translation.lang_code_to_id["bn_IN"]
|
43 |
)
|
44 |
+
translation = tokenizer_translation.batch_decode(generated_tokens, skip_special_tokens=True)
|
45 |
+
st.json(translation)
|
46 |
else:
|
47 |
+
print('invalid choice!')
|
|
|
|
|
|