Fix bug in instruction normalization

This commit is contained in:
Richard Mitic
2021-01-06 18:37:35 +01:00
parent de17085e04
commit 8ab1bdeb4a
2 changed files with 29 additions and 44 deletions

View File

@@ -28,7 +28,7 @@ def normalize_image_url(image) -> str:
def normalize_instructions(instructions) -> List[dict]:
# One long string split by (possibly multiple) new lines
if type(instructions) == str:
return [{"text": line.strip()} for line in filter(None, instructions.split("\n"))]
return [{"text": line.strip()} for line in filter(None, instructions.splitlines())]
# Plain strings in a list
elif type(instructions) == list and type(instructions[0]) == str: