GeorgeSherif commited on
Commit
acf2df4
·
1 Parent(s): fe1ea6e
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -73,7 +73,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] < 5) or
77
  ("val" not in img and annotated_images[img] == 0)
78
  ]
79
 
@@ -81,6 +81,8 @@ def get_next_image(session_data):
81
  if session_data["current_image"] is None and available_images:
82
  # Assign a new random image to the user
83
  session_data["current_image"] = random.choice(available_images)
 
 
84
  return os.path.join(image_folder, session_data["current_image"]) if session_data["current_image"] else None
85
 
86
 
@@ -139,7 +141,7 @@ def initialize_interface(session_data):
139
  next_image = get_next_image(session_data)
140
  if next_image:
141
  next_caption = get_caption_for_image_id(os.path.basename(next_image)) # Retrieve caption for initial image
142
- print(next_caption)
143
  return gr.update(value=next_image), gr.update(value=next_caption or "")
144
  else:
145
  return gr.update(visible=False), gr.update(value="All images have been annotated!")
 
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
 
 
81
  if session_data["current_image"] is None and available_images:
82
  # Assign a new random image to the user
83
  session_data["current_image"] = random.choice(available_images)
84
+ print("Current image_id:", session_data["current_image"]) # Print the current image_id
85
+
86
  return os.path.join(image_folder, session_data["current_image"]) if session_data["current_image"] else None
87
 
88
 
 
141
  next_image = get_next_image(session_data)
142
  if next_image:
143
  next_caption = get_caption_for_image_id(os.path.basename(next_image)) # Retrieve caption for initial image
144
+ print("Initial image_id:", os.path.basename(next_image)) # Print the initial image_id
145
  return gr.update(value=next_image), gr.update(value=next_caption or "")
146
  else:
147
  return gr.update(visible=False), gr.update(value="All images have been annotated!")