Spaces:
Sleeping
Sleeping
Commit
·
4e32c1e
1
Parent(s):
fe47dd5
updates
Browse files
app.py
CHANGED
|
@@ -18,6 +18,8 @@ dataset_name = "GeorgeIbrahim/EGYCOCO" # Replace with your dataset name
|
|
| 18 |
with open('nearest_neighbors_with_captions.json', 'r') as f:
|
| 19 |
results = json.load(f)
|
| 20 |
|
|
|
|
|
|
|
| 21 |
# Load or create the dataset
|
| 22 |
try:
|
| 23 |
dataset = load_dataset(dataset_name, split="train")
|
|
@@ -125,8 +127,14 @@ def save_annotation(caption, session_data):
|
|
| 125 |
return gr.update(visible=False), gr.update(value="All images have been annotated!"), gr.update(value="")
|
| 126 |
|
| 127 |
with lock:
|
|
|
|
| 128 |
image_id = session_data["current_image"]
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
# Save caption or "skipped" based on user input
|
| 131 |
if caption.strip().lower() == "skip":
|
| 132 |
caption = "skipped"
|
|
|
|
| 18 |
with open('nearest_neighbors_with_captions.json', 'r') as f:
|
| 19 |
results = json.load(f)
|
| 20 |
|
| 21 |
+
print(results)
|
| 22 |
+
|
| 23 |
# Load or create the dataset
|
| 24 |
try:
|
| 25 |
dataset = load_dataset(dataset_name, split="train")
|
|
|
|
| 127 |
return gr.update(visible=False), gr.update(value="All images have been annotated!"), gr.update(value="")
|
| 128 |
|
| 129 |
with lock:
|
| 130 |
+
match = re.search(r'_(\d+)\.', image_path)
|
| 131 |
image_id = session_data["current_image"]
|
| 132 |
+
print("Image ID before: ", image_id)
|
| 133 |
+
|
| 134 |
+
image_id_2 = match.group(1).lstrip('0')
|
| 135 |
+
split = "dev" if image_id_2 in results else "train"
|
| 136 |
+
print("Image ID after: ", image_id_2)
|
| 137 |
+
|
| 138 |
# Save caption or "skipped" based on user input
|
| 139 |
if caption.strip().lower() == "skip":
|
| 140 |
caption = "skipped"
|