Tech-Meld commited on
Commit
80b7ee0
1 Parent(s): ebe70b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -32,13 +32,14 @@ def create_captions_rich(images):
32
  """
33
  Generates captions for input images.
34
  Args:
35
- images (list): List of images to generate captions for.
36
  Returns:
37
  list: List of captions, one for each input image.
38
  """
39
  captions = []
40
- for image in images:
41
  try:
 
42
  prompt = "caption en"
43
  model_inputs = processor(text=prompt, images=image, return_tensors="pt").to("cpu")
44
  input_len = model_inputs["input_ids"].shape[-1]
 
32
  """
33
  Generates captions for input images.
34
  Args:
35
+ images (list): List of image file paths to generate captions for.
36
  Returns:
37
  list: List of captions, one for each input image.
38
  """
39
  captions = []
40
+ for image_path in images:
41
  try:
42
+ image = Image.open(image_path).convert("RGB")
43
  prompt = "caption en"
44
  model_inputs = processor(text=prompt, images=image, return_tensors="pt").to("cpu")
45
  input_len = model_inputs["input_ids"].shape[-1]