update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ import langid
|
|
21 |
from transformers import pipeline
|
22 |
|
23 |
|
24 |
-
def
|
25 |
"""
|
26 |
Language Detection using library langid
|
27 |
|
@@ -62,14 +62,15 @@ def opus_trans(message, result_lang, target_lang):
|
|
62 |
return translated
|
63 |
|
64 |
|
65 |
-
|
66 |
-
|
|
|
67 |
translate = gr.Interface(
|
68 |
opus_trans,
|
69 |
[
|
70 |
-
|
71 |
-
lang_detect
|
72 |
-
|
73 |
],
|
74 |
outputs=gr.Textbox(),
|
75 |
)
|
|
|
21 |
from transformers import pipeline
|
22 |
|
23 |
|
24 |
+
def detect_lang(article, target_lang):
|
25 |
"""
|
26 |
Language Detection using library langid
|
27 |
|
|
|
62 |
return translated
|
63 |
|
64 |
|
65 |
+
article = gr.Textbox()
|
66 |
+
lang_select = gr.Dropdown(["en", "zh"])
|
67 |
+
lang_detect = detect_lang(article, lang_select)
|
68 |
translate = gr.Interface(
|
69 |
opus_trans,
|
70 |
[
|
71 |
+
article,
|
72 |
+
lang_detect,
|
73 |
+
lang_select,
|
74 |
],
|
75 |
outputs=gr.Textbox(),
|
76 |
)
|