OMGJ commited on
Commit
e792481
1 Parent(s): f7239b0

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import transformers
2
+ from transformers import pipeline
3
+ import gradio as gr
4
+ translator = pipeline("translation" , model='Helsinki-NLP/opus-mt-fr-en')
5
+ result = translator('J\'irai à l\'eglise')
6
+ result[0]['translation_text']
7
+
8
+ def translate(input):
9
+ result = translator(input)
10
+ return result[0]['translation_text']
11
+
12
+ translation_interface = gr.Interface(fn=translate, inputs='text',outputs='text')
13
+ translation_interface.launch(share=True)