Spaces:
Build error
Build error
metadata v11
Browse files
app.py
CHANGED
|
@@ -22,7 +22,12 @@ EMBEDDINGS_FILE = EMBEDDINGS_DIR / "embeddings.pkl"
|
|
| 22 |
|
| 23 |
# β
Cargar dataset desde metadata.csv (con URLs absolutas)
|
| 24 |
dataset = load_dataset("csv", data_files="metadata.csv")
|
| 25 |
-
dataset = dataset["train"].cast_column("image", HfImage())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# π Preprocesar imagen para Facenet
|
| 28 |
def preprocess_image(img: Image.Image) -> np.ndarray:
|
|
@@ -55,10 +60,15 @@ def build_database():
|
|
| 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)
|
| 61 |
-
print(f"β οΈ Skipping item {i+j} -
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
continue
|
| 63 |
|
| 64 |
img = item["image"]
|
|
|
|
| 22 |
|
| 23 |
# β
Cargar dataset desde metadata.csv (con URLs absolutas)
|
| 24 |
dataset = load_dataset("csv", data_files="metadata.csv")
|
| 25 |
+
dataset = dataset["train"].cast_column("image", HfImage(decode=True))
|
| 26 |
+
|
| 27 |
+
# Debug dataset loading
|
| 28 |
+
print("Dataset columns:", dataset.column_names)
|
| 29 |
+
print("Dataset features:", dataset.features)
|
| 30 |
+
print("First item:", dataset[0])
|
| 31 |
|
| 32 |
# π Preprocesar imagen para Facenet
|
| 33 |
def preprocess_image(img: Image.Image) -> np.ndarray:
|
|
|
|
| 60 |
try:
|
| 61 |
print(f"Debug - Processing item {i+j}")
|
| 62 |
print(f"Debug - Item type: {type(item)}")
|
| 63 |
+
print(f"Debug - Item keys: {item.keys() if isinstance(item, dict) else 'Not a dict'}")
|
| 64 |
|
| 65 |
# Skip if item is not in the expected format
|
| 66 |
+
if not isinstance(item, dict):
|
| 67 |
+
print(f"β οΈ Skipping item {i+j} - Not a dictionary")
|
| 68 |
+
continue
|
| 69 |
+
|
| 70 |
+
if "image" not in item:
|
| 71 |
+
print(f"β οΈ Skipping item {i+j} - No image key")
|
| 72 |
continue
|
| 73 |
|
| 74 |
img = item["image"]
|