Spaces:
Build error
Build error
metadata v12
Browse files
app.py
CHANGED
@@ -47,12 +47,16 @@ def build_database():
|
|
47 |
|
48 |
for j, item in enumerate(batch):
|
49 |
try:
|
|
|
|
|
|
|
|
|
50 |
image_url = item["image"]
|
51 |
if not isinstance(image_url, str) or not image_url.startswith("http"):
|
52 |
print(f"⚠️ Saltando item {i + j} - URL inválida: {image_url}")
|
53 |
continue
|
54 |
|
55 |
-
# Descargar imagen desde URL
|
56 |
response = requests.get(image_url, timeout=10)
|
57 |
response.raise_for_status()
|
58 |
img = Image.open(BytesIO(response.content)).convert("RGB")
|
|
|
47 |
|
48 |
for j, item in enumerate(batch):
|
49 |
try:
|
50 |
+
if not isinstance(item, dict) or "image" not in item:
|
51 |
+
print(f"⚠️ Saltando item {i + j} - estructura inválida: {item}")
|
52 |
+
continue
|
53 |
+
|
54 |
image_url = item["image"]
|
55 |
if not isinstance(image_url, str) or not image_url.startswith("http"):
|
56 |
print(f"⚠️ Saltando item {i + j} - URL inválida: {image_url}")
|
57 |
continue
|
58 |
|
59 |
+
# Descargar imagen desde la URL
|
60 |
response = requests.get(image_url, timeout=10)
|
61 |
response.raise_for_status()
|
62 |
img = Image.open(BytesIO(response.content)).convert("RGB")
|