HenRick69 commited on
Commit
bef75e2
·
1 Parent(s): 08e5387

Update app.py

Browse files

New file structure

Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -1,3 +1,18 @@
1
  import gradio as gr
 
2
 
3
- gr.Interface.load("models/Helsinki-NLP/opus-mt-en-es").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()