Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -319,11 +319,13 @@ async def search_by_image(file: UploadFile = File(...), k: int = 5):
|
|
| 319 |
exact_row = find_exact_dataset_match(feats)
|
| 320 |
|
| 321 |
if exact_row is not None:
|
|
|
|
| 322 |
# Use ground-truth caption from CSV
|
| 323 |
query_caption = str(exact_row.get("caption", "")).strip()
|
| 324 |
query_caption = clean_caption(query_caption)
|
| 325 |
query_id = str(exact_row["ID"])
|
| 326 |
else:
|
|
|
|
| 327 |
# Not a known dataset image -> use BLIP1 model
|
| 328 |
query_caption = generate_caption_with_blip(image)
|
| 329 |
query_id = None
|
|
@@ -342,5 +344,6 @@ async def search_by_image(file: UploadFile = File(...), k: int = 5):
|
|
| 342 |
"modality": modality,
|
| 343 |
"scores": scores,
|
| 344 |
"results": results,
|
|
|
|
| 345 |
}
|
| 346 |
)
|
|
|
|
| 319 |
exact_row = find_exact_dataset_match(feats)
|
| 320 |
|
| 321 |
if exact_row is not None:
|
| 322 |
+
is_dataset_image = True
|
| 323 |
# Use ground-truth caption from CSV
|
| 324 |
query_caption = str(exact_row.get("caption", "")).strip()
|
| 325 |
query_caption = clean_caption(query_caption)
|
| 326 |
query_id = str(exact_row["ID"])
|
| 327 |
else:
|
| 328 |
+
is_dataset_image = False
|
| 329 |
# Not a known dataset image -> use BLIP1 model
|
| 330 |
query_caption = generate_caption_with_blip(image)
|
| 331 |
query_id = None
|
|
|
|
| 344 |
"modality": modality,
|
| 345 |
"scores": scores,
|
| 346 |
"results": results,
|
| 347 |
+
"is_dataset_image": is_dataset_image,
|
| 348 |
}
|
| 349 |
)
|