Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
-
import gradio
|
2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
3 |
|
|
|
4 |
model_name = "zaanind/nllb-ensi-v1-tuning"
|
5 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
6 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
@@ -15,10 +16,17 @@ def translate(text):
|
|
15 |
translation = tokenizer.decode(translated_tokens[0], skip_special_tokens=True)
|
16 |
return translation
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio
|
2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
3 |
|
4 |
+
|
5 |
model_name = "zaanind/nllb-ensi-v1-tuning"
|
6 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
7 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
|
|
16 |
translation = tokenizer.decode(translated_tokens[0], skip_special_tokens=True)
|
17 |
return translation
|
18 |
|
19 |
+
|
20 |
+
def nmtapifunc(text):
|
21 |
+
text = translate(text)
|
22 |
+
return text
|
23 |
+
|
24 |
+
gradio_interface = gradio.Interface(
|
25 |
+
fn=nmtapifunc,
|
26 |
+
inputs="text",
|
27 |
+
outputs="text",
|
28 |
+
title="En-Si NMT",
|
29 |
+
description="",
|
30 |
+
article="© zaanind 2024"
|
31 |
+
)
|
32 |
+
gradio_interface.launch()
|