julio07cesar10 commited on
Commit
f4dd5ec
1 Parent(s): 26d2e45

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("translation", model = "Helsinki-NLP/opus-mt-en-es")
5
+ def predict(text):
6
+ return pipe(text)[0]["translation_text"]
7
+ title ="Interactive demo: Helsinki-NLP English to Spanish Translation"
8
+ iface = gr.Interface(
9
+ fn=predict,
10
+ inputs=gr.Textbox(lines =3, placeholder ="text"),
11
+ outputs='text',
12
+ title=title,
13
+ examples=[["Hello! My name is Omar"], ["I like this workshop"]]
14
+ )
15
+ iface.launch(debug = True)