Upload color_model.py with huggingface_hub
Browse files- color_model.py +3 -1
color_model.py
CHANGED
|
@@ -69,7 +69,9 @@ class ColorDataset(Dataset):
|
|
| 69 |
Tuple of (image_tensor, token_tensor)
|
| 70 |
"""
|
| 71 |
row = self.df.iloc[idx]
|
| 72 |
-
|
|
|
|
|
|
|
| 73 |
img = self.transform(img)
|
| 74 |
tokens = torch.tensor(self.tokenizer(row[config.text_column]), dtype=torch.long)
|
| 75 |
return img, tokens
|
|
|
|
| 69 |
Tuple of (image_tensor, token_tensor)
|
| 70 |
"""
|
| 71 |
row = self.df.iloc[idx]
|
| 72 |
+
# Fix: Get the image path from the row, not the column name
|
| 73 |
+
img_path = row[config.column_local_image_path]
|
| 74 |
+
img = Image.open(img_path).convert("RGB")
|
| 75 |
img = self.transform(img)
|
| 76 |
tokens = torch.tensor(self.tokenizer(row[config.text_column]), dtype=torch.long)
|
| 77 |
return img, tokens
|