smjain commited on
Commit
060cc2f
1 Parent(s): 5b54eef

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_translation(text):
10
- inp = "translate English to French:: "+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="French Translation")
18
- grad.Interface(text2text_translation, inputs=para, outputs=out).launch()
 
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()