GlyphByT5 commited on
Commit
64485ac
1 Parent(s): fafc198

fix: add validity check for multilingual

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -655,6 +655,11 @@ def generate_image_multilingual(bg_prompt, bg_class, bg_tags, seed, cfg, *condit
655
  langs = []
656
  bboxes = []
657
  num_boxes = len(stack_cp) if len(stack_cp[-1]) == 4 else len(stack_cp) - 1
 
 
 
 
 
658
  for i in range(num_boxes):
659
  prompts.append(conditions[i])
660
  colors.append(conditions[i + MAX_TEXT_BOX])
 
655
  langs = []
656
  bboxes = []
657
  num_boxes = len(stack_cp) if len(stack_cp[-1]) == 4 else len(stack_cp) - 1
658
+
659
+ for i in range(num_boxes):
660
+ if conditions[i + MAX_TEXT_BOX * 2] is None:
661
+ raise gr.Error(f"Invalid conditions for box {i + 1} !")
662
+
663
  for i in range(num_boxes):
664
  prompts.append(conditions[i])
665
  colors.append(conditions[i + MAX_TEXT_BOX])