Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,8 @@ def translate_fb(text, src_lang, tgt_lang, max_length=400):
|
|
21 |
"""
|
22 |
Translate the text from source lang to target lang
|
23 |
"""
|
24 |
-
|
|
|
25 |
translation_pipeline = pipeline(TASK,
|
26 |
tokenizer=tokenizer,
|
27 |
src_lang=src_lang,
|
@@ -38,7 +39,7 @@ def translate_du(text, src_lang, tgt_lang, CKPT, max_length=400):
|
|
38 |
"""
|
39 |
Translate the text from source lang to target lang
|
40 |
"""
|
41 |
-
|
42 |
translation_pipeline = pipeline(TASK,
|
43 |
tokenizer=tokenizer,
|
44 |
src_lang=src_lang,
|
@@ -52,12 +53,12 @@ def translate_du(text, src_lang, tgt_lang, CKPT, max_length=400):
|
|
52 |
|
53 |
gr_fb = gr.Interface(
|
54 |
translate_fb,
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
['text'],
|
62 |
#examples=examples,
|
63 |
# article=article,
|
@@ -68,12 +69,12 @@ gr_fb = gr.Interface(
|
|
68 |
|
69 |
gr_du = gr.Interface(
|
70 |
translate_du,
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
['text'],
|
78 |
#examples=examples,
|
79 |
# article=article,
|
@@ -84,10 +85,10 @@ gr_du = gr.Interface(
|
|
84 |
gr.Parallel(
|
85 |
gr_fb,
|
86 |
gr_du,
|
87 |
-
[
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
|
|
|
21 |
"""
|
22 |
Translate the text from source lang to target lang
|
23 |
"""
|
24 |
+
print("src_lang: ",src_lang)
|
25 |
+
|
26 |
translation_pipeline = pipeline(TASK,
|
27 |
tokenizer=tokenizer,
|
28 |
src_lang=src_lang,
|
|
|
39 |
"""
|
40 |
Translate the text from source lang to target lang
|
41 |
"""
|
42 |
+
print("src_lang: ",src_lang)
|
43 |
translation_pipeline = pipeline(TASK,
|
44 |
tokenizer=tokenizer,
|
45 |
src_lang=src_lang,
|
|
|
53 |
|
54 |
gr_fb = gr.Interface(
|
55 |
translate_fb,
|
56 |
+
[
|
57 |
+
gr.components.Textbox(label="Text"),
|
58 |
+
gr.components.Dropdown(label="Source Language", choices=LANGS),
|
59 |
+
gr.components.Dropdown(label="Target Language", choices=LANGS),
|
60 |
+
#gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
|
61 |
+
],
|
62 |
['text'],
|
63 |
#examples=examples,
|
64 |
# article=article,
|
|
|
69 |
|
70 |
gr_du = gr.Interface(
|
71 |
translate_du,
|
72 |
+
[
|
73 |
+
gr.components.Textbox(label="Text"),
|
74 |
+
gr.components.Dropdown(label="Source Language", choices=LANGS),
|
75 |
+
gr.components.Dropdown(label="Target Language", choices=LANGS),
|
76 |
+
#gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
|
77 |
+
],
|
78 |
['text'],
|
79 |
#examples=examples,
|
80 |
# article=article,
|
|
|
85 |
gr.Parallel(
|
86 |
gr_fb,
|
87 |
gr_du,
|
88 |
+
# [
|
89 |
+
# gr.components.Textbox(label="Text"),
|
90 |
+
# gr.components.Dropdown(label="Source Language", choices=LANGS),
|
91 |
+
# gr.components.Dropdown(label="Target Language", choices=LANGS),
|
92 |
+
# #gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
|
93 |
+
).launch()
|
94 |
|