Skip to content

Commit

Permalink
Merge pull request #1535 from vespa-engine/thomasht86/revert-img-disk
Browse files Browse the repository at this point in the history
(colpali) do not store to disk
  • Loading branch information
ldalves authored Oct 24, 2024
2 parents 8d3573a + 261d3c6 commit 897cb10
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions visual-retrieval-colpali/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,10 @@ async def full_image(docid: str, query_id: str, idx: int):
Endpoint to get the full quality image for a given result id.
"""
image_data = await vespa_app.get_full_image_from_vespa(docid)
# Update the cache with the full image data asynchronously to not block the request
# Update the cache with the full image data
asyncio.create_task(update_full_image_cache(docid, query_id, idx, image_data))
# Save the image to a file
img_path = IMG_DIR / f"{docid}.jpg"
with open(img_path, "wb") as f:
f.write(base64.b64decode(image_data))
return Img(
src=f"/static/saved/{docid}.jpg",
src=f"data:image/png;base64,{image_data}",
alt="something",
cls="result-image w-full h-full object-contain",
)
Expand Down

0 comments on commit 897cb10

Please sign in to comment.