Spaces:
Runtime error
Runtime error
Create app.py
Browse files
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)
|