pallabi commited on
Commit
50ac962
·
verified ·
1 Parent(s): 71f714d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !pip3 install torch torchvision torchaudio
2
+ !pip install transformers gradio --upgrade
3
+
4
+ import gradio as gr
5
+ from transformers import pipeline
6
+
7
+ translation = pipeline('translation_en_to_fr')
8
+
9
+ def translate(from_text):
10
+ result = translation(from_text)[0]['translation_text']
11
+ return result
12
+
13
+ interface = gr.Interface(fn = translate , inputs = gr.Textbox(lines=2 , placeholder="text to translate") , outputs="text" )
14
+ interface.launch()
15
+
16
+
17
+