MiVaCod commited on
Commit
2e05bfe
·
verified ·
1 Parent(s): 525c7c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -34,15 +34,13 @@ model_name = "MiVaCod/mbart-neutralization"
34
  text2text_tkn= MBart50Tokenizer.from_pretrained(model_name)
35
  mdl = T5ForConditionalGeneration.from_pretrained(model_name)
36
 
37
- def text2text_paraphrase(sentence1,sentence2):
38
  inp1 = "rte sentence1: "+sentence1
39
- inp2 = "sentence2: "+sentence2
40
- combined_inp=inp1+" "+inp2
41
- enc = text2text_tkn(combined_inp, return_tensors="pt")
42
  tokens = mdl.generate(**enc)
43
  response=text2text_tkn.batch_decode(tokens)
44
  return response
45
 
46
  sent1=grad.Textbox(lines=1, label="Frase misógina", placeholder="Introduce una frase misógina")
47
  out=grad.Textbox(lines=1, label="Frase corregida")
48
- grad.Interface(text2text_paraphrase, inputs=[sent1,sent2], outputs=out).launch()
 
34
  text2text_tkn= MBart50Tokenizer.from_pretrained(model_name)
35
  mdl = T5ForConditionalGeneration.from_pretrained(model_name)
36
 
37
+ def text2text_paraphrase(sentence1):
38
  inp1 = "rte sentence1: "+sentence1
39
+ enc = text2text_tkn(inp1, return_tensors="pt")
 
 
40
  tokens = mdl.generate(**enc)
41
  response=text2text_tkn.batch_decode(tokens)
42
  return response
43
 
44
  sent1=grad.Textbox(lines=1, label="Frase misógina", placeholder="Introduce una frase misógina")
45
  out=grad.Textbox(lines=1, label="Frase corregida")
46
+ grad.Interface(text2text_paraphrase, inputs=[sent1], outputs=out).launch()