Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
| 36 |
Returns:
|
| 37 |
list: List of captions, one for each input image.
|
| 38 |
"""
|
| 39 |
captions = []
|
| 40 |
-
for
|
| 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]
|