Spaces:
Sleeping
Sleeping
Commit
·
9473a08
1
Parent(s):
f422757
updates
Browse files
app.py
CHANGED
@@ -104,16 +104,22 @@ def get_caption_for_image_id(image_path):
|
|
104 |
def get_next_image(session_data):
|
105 |
with lock:
|
106 |
# Available images filter
|
107 |
-
available_images = [
|
108 |
-
img for img in image_files
|
109 |
-
print(img)
|
110 |
-
match = re.search(r'_(\d+)\.', img)
|
111 |
-
image_id = match.group(1).lstrip('0') # Remove leading zeros
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
print("Available images:", available_images) # Debugging line
|
119 |
|
|
|
104 |
def get_next_image(session_data):
|
105 |
with lock:
|
106 |
# Available images filter
|
107 |
+
available_images = []
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
# Iterate over each image file to apply the filtering logic
|
110 |
+
for img in image_files:
|
111 |
+
print(img) # Debugging line to print each image filename
|
112 |
+
|
113 |
+
# Match and extract the image_id from the filename
|
114 |
+
match = re.search(r'_(\d+)\.', img)
|
115 |
+
if match:
|
116 |
+
image_id = match.group(1).lstrip('0') # Remove leading zeros
|
117 |
+
|
118 |
+
# Apply the filtering conditions
|
119 |
+
if (img not in annotation_counts or
|
120 |
+
(image_id in results and annotation_counts.get(img, 0) < 2) or
|
121 |
+
(image_id not in results and annotation_counts.get(img, 0) == 0)):
|
122 |
+
available_images.append(img)
|
123 |
|
124 |
print("Available images:", available_images) # Debugging line
|
125 |
|