Spaces:
Runtime error
Runtime error
Update app.py
Browse filesNew file structure
app.py
CHANGED
@@ -1,3 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
5 |
+
|
6 |
+
def predict(text):
|
7 |
+
return pipe(text)[0]["translation_text"]
|
8 |
+
|
9 |
+
demo = gr.Interface(
|
10 |
+
fn=predict,
|
11 |
+
inputs='text',
|
12 |
+
outputs='text',
|
13 |
+
)
|
14 |
+
|
15 |
+
print('English to Spanish translation!! :)')
|
16 |
+
print('Traducción de Inglés a Español! :D\n')
|
17 |
+
|
18 |
+
demo.launch()
|