Spaces:
Runtime error
Runtime error
Update links
Browse files- .gitignore +1 -1
- __pycache__/ui.cpython-310.pyc +0 -0
- app.py +5 -4
- ui.py +2 -2
.gitignore
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
.devcontainer/*
|
2 |
__pycache__/*
|
3 |
-
|
|
|
1 |
.devcontainer/*
|
2 |
__pycache__/*
|
3 |
+
__pycache__/ui.cpython-310.pyc
|
__pycache__/ui.cpython-310.pyc
CHANGED
Binary files a/__pycache__/ui.cpython-310.pyc and b/__pycache__/ui.cpython-310.pyc differ
|
|
app.py
CHANGED
@@ -12,6 +12,7 @@ tokenizer = AutoTokenizer.from_pretrained(CKPT)
|
|
12 |
|
13 |
device = 0 if torch.cuda.is_available() else -1
|
14 |
|
|
|
15 |
def translate(text, src_lang, tgt_lang, max_length=400):
|
16 |
"""
|
17 |
Translate the text from source lang to target lang
|
@@ -31,10 +32,10 @@ def translate(text, src_lang, tgt_lang, max_length=400):
|
|
31 |
gr.Interface(
|
32 |
translate,
|
33 |
[
|
34 |
-
gr.
|
35 |
-
gr.
|
36 |
-
gr.
|
37 |
-
gr.
|
38 |
],
|
39 |
["text"],
|
40 |
examples=examples,
|
|
|
12 |
|
13 |
device = 0 if torch.cuda.is_available() else -1
|
14 |
|
15 |
+
|
16 |
def translate(text, src_lang, tgt_lang, max_length=400):
|
17 |
"""
|
18 |
Translate the text from source lang to target lang
|
|
|
32 |
gr.Interface(
|
33 |
translate,
|
34 |
[
|
35 |
+
gr.components.Textbox(label="Text"),
|
36 |
+
gr.components.Dropdown(label="Source Language", choices=LANGS),
|
37 |
+
gr.components.Dropdown(label="Target Language", choices=LANGS),
|
38 |
+
gr.components.Slider(8, 512, value=400, step=8, label="Max Length")
|
39 |
],
|
40 |
["text"],
|
41 |
examples=examples,
|
ui.py
CHANGED
@@ -2,8 +2,8 @@ title = "NLLB TRANSLATION Demo"
|
|
2 |
description = """
|
3 |
<p>
|
4 |
<center>
|
5 |
-
Translator using Facebook's NLLB models.
|
6 |
-
Developed by <a href='https://www.narrativa.com/'>Narrativa</a>.
|
7 |
<img src="https://raw.githubusercontent.com/facebookresearch/fairseq/nllb/nllb.png" alt="meta nllb pic" width="700"/>
|
8 |
</center>
|
9 |
</p>
|
|
|
2 |
description = """
|
3 |
<p>
|
4 |
<center>
|
5 |
+
Translator using <a href='https://ai.facebook.com/research/no-language-left-behind/' target='_blank'>Facebook's NLLB</a> models.
|
6 |
+
Developed by <a href='https://www.narrativa.com/' target='_blank'>Narrativa</a>.
|
7 |
<img src="https://raw.githubusercontent.com/facebookresearch/fairseq/nllb/nllb.png" alt="meta nllb pic" width="700"/>
|
8 |
</center>
|
9 |
</p>
|