liuhaotian commited on
Commit
886d221
1 Parent(s): 5c79044

relexes constraint to reduce error rate

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -259,7 +259,11 @@ def generate(task, language_instruction, grounding_texts, sketch_pad,
259
 
260
  boxes = state['boxes']
261
  grounding_texts = [x.strip() for x in grounding_texts.split(';')]
262
- assert len(boxes) == len(grounding_texts)
 
 
 
 
263
  boxes = (np.asarray(boxes) / 512).tolist()
264
  grounding_instruction = json.dumps({obj: box for obj,box in zip(grounding_texts, boxes)})
265
 
 
259
 
260
  boxes = state['boxes']
261
  grounding_texts = [x.strip() for x in grounding_texts.split(';')]
262
+ # assert len(boxes) == len(grounding_texts)
263
+ if len(boxes) != len(grounding_texts):
264
+ assert len(boxes) > len(grounding_texts)
265
+ grounding_texts = grounding_texts + [""] * (len(boxes) - len(grounding_texts))
266
+
267
  boxes = (np.asarray(boxes) / 512).tolist()
268
  grounding_instruction = json.dumps({obj: box for obj,box in zip(grounding_texts, boxes)})
269