SerenaTOUM commited on
Commit
9aad3f0
·
verified ·
1 Parent(s): 9bb3ea6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
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)