File size: 664 Bytes
28844b4
 
 
 
bdf5255
28844b4
9421f09
28844b4
 
 
 
 
 
 
 
 
88bab5b
 
 
 
 
 
28844b4
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from transformers import pipeline
generate=pipeline("translation_en_to_fr",model="t5-large")
import gradio as gr

title=""" <hi> Translate English text to French</h1>"""

description="""<h5> This app is for english french language translation</h5>"""

def en_fr(english_text):

  fr=generate(english_text)

  translation=fr[0]["translation_text"]

  return translation

demo =gr.Interface(fn=en_fr,
          inputs=gr.Textbox(label="English"),
          outputs=gr.Textbox(label="French"),
          title=title,
          description=description,
          examples=[["Hello! My name is Abubakar"], ["How are you?"]])

if __name__ =="__main__":
    demo.launch()