ifire commited on
Commit
8ea6b53
1 Parent(s): 38476d8

Avoid coord error with lacking ":".

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -90,7 +90,11 @@ def prompt_to_layout(user_prompt, intensity, fpath=None):
90
  output = tokenizer.batch_decode(output, skip_special_tokens=True)
91
  layout = output[0].split('[User prompt]')[1].split('[Layout] ')[1].split(', ')
92
  spaces = [txt.split(':')[0] for txt in layout]
93
- coords = [txt.split(':')[1].rstrip() for txt in layout]
 
 
 
 
94
  coordinates = [re.findall(regex, coord) for coord in coords]
95
 
96
  num_coords = []
 
90
  output = tokenizer.batch_decode(output, skip_special_tokens=True)
91
  layout = output[0].split('[User prompt]')[1].split('[Layout] ')[1].split(', ')
92
  spaces = [txt.split(':')[0] for txt in layout]
93
+ coords = []
94
+ for txt in layout:
95
+ if ':' in txt:
96
+ split_txt = txt.split(':')
97
+ coords.append(split_txt[1].rstrip())
98
  coordinates = [re.findall(regex, coord) for coord in coords]
99
 
100
  num_coords = []