harishrb commited on
Commit
b3e288e
1 Parent(s): 2773af8

Application file commit

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
+
6
+ def predict(text):
7
+ return pipe(text)[0]["translation_text"]
8
+
9
+ with gr.Blocks() as demo:
10
+ english_inp = gr.Textbox(label="English Sentence")
11
+ spanish_op = gr.Textbox(label="Spanish Translation")
12
+ translate_btn = gr.Button("Translate")
13
+ translate_btn.click(fn=predict, inputs=english_inp, outputs=spanish_op)
14
+
15
+ demo.launch()