AriusXi commited on
Commit
1378dc4
·
1 Parent(s): 9a90f9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -5,15 +5,16 @@ 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()
 
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
+
19
  out=grad.Textbox(lines=1, label="Whether sentence2 is deductible from sentence1")
20
  grad.Interface(text2text_ deductible, inputs=[sent1,sent2], outputs=out).launch()