lucianotonet commited on
Commit
18c3760
1 Parent(s): f3c27dd

Refactor image processing in prediction flow

Browse files

Streamlined the image handling logic by assigning the processed image to a variable before appending it to the list. This change enhances code readability and maintainability, ensuring easier debugging and potential adjustments in the image processing pipeline.

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -44,7 +44,8 @@ async def predict(messages: List[Dict[str, Union[str, List[Dict[str, str]]]]] =
44
  if item["type"] == "text":
45
  texts.append(processor.apply_chat_template(item["text"], tokenize=False, add_generation_prompt=True))
46
  elif item["type"] == "image":
47
- image_inputs.append(process_image(item["image"]))
 
48
  else:
49
  raise ValueError(f"Formato inválido para o item: {item}")
50
  else:
 
44
  if item["type"] == "text":
45
  texts.append(processor.apply_chat_template(item["text"], tokenize=False, add_generation_prompt=True))
46
  elif item["type"] == "image":
47
+ image = process_image(item["image"])
48
+ image_inputs.append(image)
49
  else:
50
  raise ValueError(f"Formato inválido para o item: {item}")
51
  else: