Update app.py
Browse files
app.py
CHANGED
@@ -7,12 +7,12 @@ mdl = T5ForConditionalGeneration.from_pretrained("t5-small")
|
|
7 |
|
8 |
|
9 |
def text2text_translation(text):
|
10 |
-
inp = "translate English to
|
11 |
enc = text2text_tkn(inp, return_tensors="pt")
|
12 |
tokens = mdl.generate(**enc)
|
13 |
response=text2text_tkn.batch_decode(tokens)
|
14 |
return response
|
15 |
|
16 |
para=grad.Textbox(lines=1, label="English Text", placeholder="Text in English")
|
17 |
-
out=grad.Textbox(lines=1, label="
|
18 |
grad.Interface(text2text_translation, inputs=para, outputs=out).launch()
|
|
|
7 |
|
8 |
|
9 |
def text2text_translation(text):
|
10 |
+
inp = "translate English to French:: "+text
|
11 |
enc = text2text_tkn(inp, return_tensors="pt")
|
12 |
tokens = mdl.generate(**enc)
|
13 |
response=text2text_tkn.batch_decode(tokens)
|
14 |
return response
|
15 |
|
16 |
para=grad.Textbox(lines=1, label="English Text", placeholder="Text in English")
|
17 |
+
out=grad.Textbox(lines=1, label="French Translation")
|
18 |
grad.Interface(text2text_translation, inputs=para, outputs=out).launch()
|