Spaces:
Sleeping
Sleeping
Update length
Browse files
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
|
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
|
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):
|