Update app.py
Browse files
app.py
CHANGED
@@ -6,13 +6,13 @@ mdl = T5ForConditionalGeneration.from_pretrained("t5-small")
|
|
6 |
|
7 |
|
8 |
|
9 |
-
def
|
10 |
-
inp = "
|
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(
|
|
|
6 |
|
7 |
|
8 |
|
9 |
+
def text2text_acceptable_sentence(text):
|
10 |
+
inp = "cola sentence: "+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="Whether the sentence is acceptable or not")
|
18 |
+
grad.Interface(text2text_acceptable_sentence, inputs=para, outputs=out).launch()
|