GeorgeIbrahim commited on
Commit
4254bd0
·
1 Parent(s): fc753c1
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -55,6 +55,21 @@ try:
55
 
56
  print("Annotation counts:", annotation_counts)
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # Initialize or reset data as needed based on the `reset` flag
59
  if reset:
60
  # Clear the annotation counts
@@ -79,19 +94,6 @@ if reset:
79
  dataset.push_to_hub(dataset_name)
80
  print("Data has been reset.")
81
 
82
- except Exception as e:
83
- print(f"Error loading dataset: {e}")
84
- # Create an empty dataset if it doesn't exist
85
- features = Features({
86
- 'image_id': Value(dtype='string'),
87
- 'caption': Value(dtype='string'),
88
- 'annotation_count': Value(dtype='int32'),
89
- 'split': Value(dtype='string')
90
- })
91
- dataset = Dataset.from_dict({'image_id': [], 'caption': [], 'annotation_count': [], 'split': []}, features=features)
92
- annotation_counts = {}
93
- dataset.push_to_hub(dataset_name) # Push the empty dataset to Hugging Face
94
-
95
  image_folder = "images"
96
  image_files = [f for f in os.listdir(image_folder) if f.endswith(('.png', '.jpg', '.jpeg'))]
97
  lock = threading.Lock()
 
55
 
56
  print("Annotation counts:", annotation_counts)
57
 
58
+
59
+ except Exception as e:
60
+ print(f"Error loading dataset: {e}")
61
+ # Create an empty dataset if it doesn't exist
62
+ features = Features({
63
+ 'image_id': Value(dtype='string'),
64
+ 'caption': Value(dtype='string'),
65
+ 'annotation_count': Value(dtype='int32'),
66
+ 'split': Value(dtype='string')
67
+ })
68
+ dataset = Dataset.from_dict({'image_id': [], 'caption': [], 'annotation_count': [], 'split': []}, features=features)
69
+ annotation_counts = {}
70
+ dataset.push_to_hub(dataset_name) # Push the empty dataset to Hugging Face
71
+
72
+
73
  # Initialize or reset data as needed based on the `reset` flag
74
  if reset:
75
  # Clear the annotation counts
 
94
  dataset.push_to_hub(dataset_name)
95
  print("Data has been reset.")
96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  image_folder = "images"
98
  image_files = [f for f in os.listdir(image_folder) if f.endswith(('.png', '.jpg', '.jpeg'))]
99
  lock = threading.Lock()