Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -94,16 +94,16 @@ class Pix2PixDataset(torch.utils.data.Dataset):
|
|
94 |
original = original_img.convert('RGB')
|
95 |
target = target_img.convert('RGB')
|
96 |
|
97 |
-
# Extract the filename from the original image's path
|
98 |
-
original_img_path =
|
99 |
original_img_filename = os.path.basename(original_img_path)
|
100 |
-
|
101 |
# Match the image filename with the `image_path` column in the CSV
|
102 |
matched_row = self.data[self.data['image_path'].str.contains(original_img_filename)]
|
103 |
|
104 |
if matched_row.empty:
|
105 |
raise ValueError(f"No matching entry found in the CSV for image {original_img_filename}")
|
106 |
-
|
107 |
# Get the prompts from the matched row
|
108 |
original_prompt = matched_row['original_prompt'].values[0]
|
109 |
enhanced_prompt = matched_row['enhanced_prompt'].values[0]
|
|
|
94 |
original = original_img.convert('RGB')
|
95 |
target = target_img.convert('RGB')
|
96 |
|
97 |
+
# Extract the filename from the original image's path
|
98 |
+
original_img_path = original_img.filename # Ensure this is the correct way to get the path
|
99 |
original_img_filename = os.path.basename(original_img_path)
|
100 |
+
|
101 |
# Match the image filename with the `image_path` column in the CSV
|
102 |
matched_row = self.data[self.data['image_path'].str.contains(original_img_filename)]
|
103 |
|
104 |
if matched_row.empty:
|
105 |
raise ValueError(f"No matching entry found in the CSV for image {original_img_filename}")
|
106 |
+
|
107 |
# Get the prompts from the matched row
|
108 |
original_prompt = matched_row['original_prompt'].values[0]
|
109 |
enhanced_prompt = matched_row['enhanced_prompt'].values[0]
|