Spaces:
Build error
Build error
metadata v10
Browse files
app.py
CHANGED
|
@@ -55,16 +55,20 @@ def build_database():
|
|
| 55 |
try:
|
| 56 |
print(f"Debug - Processing item {i+j}")
|
| 57 |
print(f"Debug - Item type: {type(item)}")
|
| 58 |
-
print(f"Debug - Item content: {item}")
|
| 59 |
|
| 60 |
-
#
|
| 61 |
-
if isinstance(item, dict):
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
img = item.image
|
| 65 |
|
|
|
|
| 66 |
print(f"Debug - Image type: {type(img)}")
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
# Ensure image is in RGB mode
|
| 69 |
img = img.convert("RGB")
|
| 70 |
img_processed = preprocess_image(img)
|
|
|
|
| 55 |
try:
|
| 56 |
print(f"Debug - Processing item {i+j}")
|
| 57 |
print(f"Debug - Item type: {type(item)}")
|
|
|
|
| 58 |
|
| 59 |
+
# Skip if item is not in the expected format
|
| 60 |
+
if not isinstance(item, dict) or "image" not in item:
|
| 61 |
+
print(f"⚠️ Skipping item {i+j} - Invalid format")
|
| 62 |
+
continue
|
|
|
|
| 63 |
|
| 64 |
+
img = item["image"]
|
| 65 |
print(f"Debug - Image type: {type(img)}")
|
| 66 |
|
| 67 |
+
# Skip if image is not a PIL Image
|
| 68 |
+
if not isinstance(img, Image.Image):
|
| 69 |
+
print(f"⚠️ Skipping item {i+j} - Not a PIL Image")
|
| 70 |
+
continue
|
| 71 |
+
|
| 72 |
# Ensure image is in RGB mode
|
| 73 |
img = img.convert("RGB")
|
| 74 |
img_processed = preprocess_image(img)
|