Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,19 @@
|
|
1 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
2 |
import gradio as grad
|
3 |
|
4 |
-
text2text_tkn= T5Tokenizer.from_pretrained("t5-
|
5 |
-
mdl = T5ForConditionalGeneration.from_pretrained("t5-
|
6 |
|
7 |
-
def
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
sent1=grad.Textbox(lines=1, label="Sentence1",placeholder="Text in English")
|
17 |
-
sent2=grad.Textbox(lines=1, label="Sentence2",placeholder="Text in English")
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
grad.Interface(text2text_paraphrase, inputs=[sent1,sent2],outputs=out).launch()
|
|
|
1 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
2 |
import gradio as grad
|
3 |
|
4 |
+
text2text_tkn= T5Tokenizer.from_pretrained("t5-small")
|
5 |
+
mdl = T5ForConditionalGeneration.from_pretrained("t5-small")
|
6 |
|
7 |
+
def text2text_deductible(sentence1,sentence2):
|
8 |
+
inp1 = "rte sentence1: "+sentence1
|
9 |
+
inp2 = "sentence2: "+sentence2
|
10 |
+
combined_inp=inp1+" "+inp2
|
11 |
+
enc = text2text_tkn(combined_inp, return_tensors="pt")
|
12 |
+
tokens = mdl.generate(**enc)
|
13 |
+
response=text2text_tkn.batch_decode(tokens)
|
14 |
+
return response
|
15 |
|
16 |
+
sent1=grad.Textbox(lines=1, label="Sentence1", placeholder="Text in English")
|
17 |
+
sent2=grad.Textbox(lines=1, label="Sentence2", placeholder="Text in English")
|
18 |
+
out=grad.Textbox(lines=1, label="Whether sentence2 is deductible from sentence1")
|
19 |
+
grad.Interface(text2text_ deductible, inputs=[sent1,sent2], outputs=out).launch()
|
|
|
|