Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sentencepiece
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
translator = pipeline("translation",model="Helsinki-NLP/opus-mt-fr-en")
|
| 4 |
+
|
| 5 |
+
import gradio as gr
|
| 6 |
+
|
| 7 |
+
def translation (text):
|
| 8 |
+
traduction = translator(text)
|
| 9 |
+
return traduction[0]["translation_text"]
|
| 10 |
+
|
| 11 |
+
demo = gr.Interface(translation, title= "TRADUCTION", inputs = "text", outputs = "text", description = "Traduisons ce texte du français vers l'anglais ! Allons y")
|
| 12 |
+
demo.launch(quiet = True)
|