This is the main part of the code
Browse files
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def traductor(prompt):
|
| 6 |
+
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
| 7 |
+
frase_traducida=pipe(prompt)
|
| 8 |
+
return frase_traducida[0]['translation_text']
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(fn=traductor, inputs="text", outputs="text")
|
| 11 |
+
demo.launch()
|