Mds21 commited on
Commit
42237e9
1 Parent(s): 5c542d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ translation_pipeline = pipeline('translation_en_to_de')
4
+ results = translation_pipeline('I love ice cream')
5
+ results[0]['translation_text']
6
+ def translate_transformers(from_text):
7
+ results = translation_pipeline(from_text)
8
+ return results[0]['translation_text']
9
+
10
+ interface = gr.Interface(fn=translate_transformers,
11
+ inputs=gr.inputs.Textbox(lines=2, placeholder='Text to translate'),
12
+ outputs='text')
13
+
14
+ interface.launch()