GeorgeSherif commited on
Commit
b2825d5
·
1 Parent(s): 15b85c1
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -22,12 +22,15 @@ try:
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({
33
  'image_id': Value(dtype='string'),
 
22
 
23
  # Update annotation_count for existing images
24
  def update_annotation_count(example):
25
+ if example["annotation_count"] == 0:
26
+ example["annotation_count"] = 1
27
  return example
28
 
29
  dataset = dataset.map(update_annotation_count)
30
  print("Updated annotation counts for existing images.")
31
+ dataset.push_to_hub(dataset_name) # Push the updated dataset to Hugging Face
32
  except Exception as e:
33
+ print(f"Error loading dataset: {e}")
34
  # Create an empty dataset if it doesn't exist
35
  features = Features({
36
  'image_id': Value(dtype='string'),