Update app.py
Browse files
app.py
CHANGED
@@ -6,13 +6,16 @@ mdl = T5ForConditionalGeneration.from_pretrained("t5-small")
|
|
6 |
|
7 |
|
8 |
|
9 |
-
def
|
10 |
-
|
11 |
-
|
|
|
|
|
12 |
tokens = mdl.generate(**enc)
|
13 |
response=text2text_tkn.batch_decode(tokens)
|
14 |
return response
|
15 |
|
16 |
-
|
|
|
17 |
out=grad.Textbox(lines=1, label="Whether the sentence is acceptable or not")
|
18 |
-
grad.Interface(
|
|
|
6 |
|
7 |
|
8 |
|
9 |
+
def text2text_paraphrase(sentence1,sentence2):
|
10 |
+
inp1 = "mrpc sentence1: "+sentence1
|
11 |
+
inp2 = "sentence2: "+sentence2
|
12 |
+
combined_inp=inp1+" "+inp2
|
13 |
+
enc = text2text_tkn(combined_inp, return_tensors="pt")
|
14 |
tokens = mdl.generate(**enc)
|
15 |
response=text2text_tkn.batch_decode(tokens)
|
16 |
return response
|
17 |
|
18 |
+
sent1=grad.Textbox(lines=1, label="English Text", placeholder="Text in English")
|
19 |
+
sent2=grad.Textbox(lines=1, label="English Text", placeholder="Text in English")
|
20 |
out=grad.Textbox(lines=1, label="Whether the sentence is acceptable or not")
|
21 |
+
grad.Interface(text2text_paraphrase, inputs=[sent1,sent2], outputs=out).launch()
|