smjain commited on
Commit
0ce6319
1 Parent(s): 060cc2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -6,13 +6,13 @@ mdl = T5ForConditionalGeneration.from_pretrained("t5-small")
6
 
7
 
8
 
9
- def text2text_sentiment(text):
10
- inp = "sst2 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="Sentiment")
18
- grad.Interface(text2text_sentiment, inputs=para, outputs=out).launch()
 
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()