Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,7 @@ def translate_du(text, src_lang, tgt_lang, CKPT, max_length=400):
|
|
43 |
tokenizer=tokenizer,
|
44 |
src_lang=src_lang,
|
45 |
tgt_lang=tgt_lang,
|
46 |
-
|
47 |
max_length=max_length,
|
48 |
device=device)
|
49 |
|
@@ -52,12 +52,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,19 +68,26 @@ 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,
|
80 |
cache_examples=False,
|
81 |
title="nllb-200-distilled-600M-Finetuned",
|
82 |
-
#description=description
|
83 |
)
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
|
|
43 |
tokenizer=tokenizer,
|
44 |
src_lang=src_lang,
|
45 |
tgt_lang=tgt_lang,
|
46 |
+
/ model = du_model,
|
47 |
max_length=max_length,
|
48 |
device=device)
|
49 |
|
|
|
52 |
|
53 |
gr_fb = gr.Interface(
|
54 |
translate_fb,
|
55 |
+
# [
|
56 |
+
# gr.components.Textbox(label="Text"),
|
57 |
+
# gr.components.Dropdown(label="Source Language", choices=LANGS),
|
58 |
+
# gr.components.Dropdown(label="Target Language", choices=LANGS),
|
59 |
+
# #gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
|
60 |
+
# ],
|
61 |
['text'],
|
62 |
#examples=examples,
|
63 |
# article=article,
|
|
|
68 |
|
69 |
gr_du = gr.Interface(
|
70 |
translate_du,
|
71 |
+
# [
|
72 |
+
# gr.components.Textbox(label="Text"),
|
73 |
+
# gr.components.Dropdown(label="Source Language", choices=LANGS),
|
74 |
+
# gr.components.Dropdown(label="Target Language", choices=LANGS),
|
75 |
+
# #gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
|
76 |
+
# ],
|
77 |
['text'],
|
78 |
#examples=examples,
|
79 |
# article=article,
|
80 |
cache_examples=False,
|
81 |
title="nllb-200-distilled-600M-Finetuned",
|
82 |
+
# description=description
|
83 |
)
|
84 |
+
gr.Parallel(
|
85 |
+
gr_fb,
|
86 |
+
gr_du,
|
87 |
+
[
|
88 |
+
gr.components.Textbox(label="Text"),
|
89 |
+
gr.components.Dropdown(label="Source Language", choices=LANGS),
|
90 |
+
gr.components.Dropdown(label="Target Language", choices=LANGS),
|
91 |
+
#gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
|
92 |
+
],).launch()
|
93 |
|