Spaces:
Runtime error
Runtime error
Pablo Ojea Lopez
commited on
Commit
·
10c3493
1
Parent(s):
d132638
Prueba_09
Browse files- app.py +6 -3
- requirements.txt +1 -2
app.py
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
-
import sentencepiece
|
2 |
import gradio as gr
|
3 |
-
from transformers import pipeline
|
|
|
|
|
|
|
|
|
4 |
|
5 |
def translate(name):
|
6 |
|
7 |
-
trans = pipeline("translation", model
|
8 |
return trans(name)[0]["translation_text"]
|
9 |
|
10 |
demo = gr.Interface(fn=translate, inputs="text", outputs="text")
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM
|
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")
|
requirements.txt
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
transformers
|
2 |
gradio
|
3 |
-
torch
|
4 |
-
sentencepiece
|
|
|
1 |
transformers
|
2 |
gradio
|
3 |
+
torch
|
|