youj2005 commited on
Commit
2eba1ff
·
1 Parent(s): 19dbb2e

Update length

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -11,10 +11,10 @@ qa_model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-base", dev
11
  def predict(context, intent):
12
  input_text = "In one word, what is the opposite of: " + intent + "?"
13
  input_ids = qa_tokenizer(input_text, return_tensors="pt").input_ids
14
- opposite_output = qa_tokenizer.decode(qa_model.generate(input_ids, max_length = 1)[0])
15
  input_text = "In one word, what is the following describing: " + context
16
  input_ids = qa_tokenizer(input_text, return_tensors="pt").input_ids
17
- object_output = qa_tokenizer.decode(qa_model.generate(input_ids, max_length = 1)[0])
18
  batch = ['I think the ' + object_output + ' are long.', 'I think the ' + object_output + ' are ' + opposite_output, 'I think the ' + object_output + ' are the perfect']
19
  outputs = []
20
  for i, hypothesis in enumerate(batch):
 
11
  def predict(context, intent):
12
  input_text = "In one word, what is the opposite of: " + intent + "?"
13
  input_ids = qa_tokenizer(input_text, return_tensors="pt").input_ids
14
+ opposite_output = qa_tokenizer.decode(qa_model.generate(input_ids, max_length=2)[0])
15
  input_text = "In one word, what is the following describing: " + context
16
  input_ids = qa_tokenizer(input_text, return_tensors="pt").input_ids
17
+ object_output = qa_tokenizer.decode(qa_model.generate(input_ids, max_length=2)[0])
18
  batch = ['I think the ' + object_output + ' are long.', 'I think the ' + object_output + ' are ' + opposite_output, 'I think the ' + object_output + ' are the perfect']
19
  outputs = []
20
  for i, hypothesis in enumerate(batch):