Spaces:
Runtime error
Runtime error
Pablo Ojea Lopez
commited on
Commit
·
cf67639
1
Parent(s):
851861b
Prueba_10
Browse files
app.py
CHANGED
@@ -1,13 +1,11 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
-
|
4 |
-
tokenizer = AutoTokenizer.from_pretrained("Helsinki-NLP/opus-mt-en-es")
|
5 |
-
|
6 |
-
model = AutoModelForSeq2SeqLM.from_pretrained("Helsinki-NLP/opus-mt-en-es")
|
7 |
|
|
|
8 |
def translate(name):
|
9 |
|
10 |
-
trans = pipeline("translation", model, tokenizer)
|
11 |
return trans(name)[0]["translation_text"]
|
12 |
|
13 |
demo = gr.Interface(fn=translate, inputs="text", outputs="text")
|
|
|
1 |
+
import sentencepiece
|
2 |
import gradio as gr
|
3 |
+
from transformers import pipeline
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
print (dir(sentencepiece))
|
6 |
def translate(name):
|
7 |
|
8 |
+
trans = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es", tokenizer="Helsinki-NLP/opus-mt-en-es")
|
9 |
return trans(name)[0]["translation_text"]
|
10 |
|
11 |
demo = gr.Interface(fn=translate, inputs="text", outputs="text")
|