GeorgeSherif commited on
Commit
15b85c1
·
1 Parent(s): acf2df4
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -19,6 +19,14 @@ dataset_name = "GeorgeIbrahim/EGYCOCO" # Replace with your dataset name
19
  try:
20
  dataset = load_dataset(dataset_name, split="train")
21
  print("Loaded existing dataset:", dataset)
 
 
 
 
 
 
 
 
22
  except Exception as e:
23
  # Create an empty dataset if it doesn't exist
24
  features = Features({
@@ -73,7 +81,7 @@ def get_next_image(session_data):
73
  available_images = [
74
  img for img in image_files
75
  if img not in annotated_images or
76
- ("val" in img and annotated_images[img] < 2) or
77
  ("val" not in img and annotated_images[img] == 0)
78
  ]
79
 
 
19
  try:
20
  dataset = load_dataset(dataset_name, split="train")
21
  print("Loaded existing dataset:", dataset)
22
+
23
+ # Update annotation_count for existing images
24
+ def update_annotation_count(example):
25
+ example["annotation_count"] = 1 if example["annotation_count"] == 0 else example["annotation_count"]
26
+ return example
27
+
28
+ dataset = dataset.map(update_annotation_count)
29
+ print("Updated annotation counts for existing images.")
30
  except Exception as e:
31
  # Create an empty dataset if it doesn't exist
32
  features = Features({
 
81
  available_images = [
82
  img for img in image_files
83
  if img not in annotated_images or
84
+ ("val" in img and annotated_images[img] < 5) or
85
  ("val" not in img and annotated_images[img] == 0)
86
  ]
87