GeorgeIbrahim commited on
Commit
7da9aa9
·
1 Parent(s): d7e002e
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -25,14 +25,15 @@ try:
25
  dataset = load_dataset(dataset_name, split="train")
26
  print("Loaded existing dataset:", dataset)
27
  print("Dataset features:", dataset.features) # Check if 'split' is part of features
28
-
 
29
  # Check if the 'split' column exists; if not, add it
30
  if 'split' not in dataset.column_names:
31
- # Define the 'split' values based on `image_id`
32
- print(results)
33
- print(example["image_id"] in results)
34
  split_values = [
35
- "dev" if example["image_id"] in results else "train"
36
  for example in dataset
37
  ]
38
 
 
25
  dataset = load_dataset(dataset_name, split="train")
26
  print("Loaded existing dataset:", dataset)
27
  print("Dataset features:", dataset.features) # Check if 'split' is part of features
28
+
29
+
30
  # Check if the 'split' column exists; if not, add it
31
  if 'split' not in dataset.column_names:
32
+ match = re.search(r'_(\d+)\.', example["image_id"])
33
+ image_id = match.group(1).lstrip('0')
34
+
35
  split_values = [
36
+ "dev" if image_id in results else "train"
37
  for example in dataset
38
  ]
39