K00B404 commited on
Commit
7c9aa1b
·
verified ·
1 Parent(s): 6623f2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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 (assuming it has a 'filename' field or path)
98
- original_img_path = self.originals[idx]['image'].filename # Assuming it has this attribute
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]