Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
generate=pipeline("translation_en_to_fr",model="t5-large")
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
title=""" <hi> Here to convert your English text to French</h1>"""
|
6 |
+
|
7 |
+
description="""<h5> This demo app is for english french language translation</h5>"""
|
8 |
+
|
9 |
+
def en_fr(english_text):
|
10 |
+
|
11 |
+
fr=generate(english_text)
|
12 |
+
|
13 |
+
translation=fr[0]["translation_text"]
|
14 |
+
|
15 |
+
return translation
|
16 |
+
|
17 |
+
demo =gr.Interface(fn=en_fr,inputs=gr.Textbox(label="English version"),outputs=gr.Textbox(label="French version"),title=title,description=description)
|
18 |
+
|
19 |
+
if __name__ =="__main__":
|
20 |
+
demo.launch()
|