Spaces:
Running
on
T4
Running
on
T4
Upload folder using huggingface_hub
Browse files
main.py
CHANGED
@@ -270,15 +270,10 @@ async def get_sim_map(query_id: str, idx: int, token: str):
|
|
270 |
|
271 |
async def update_full_image_cache(docid: str, query_id: str, idx: int, image_data: str):
|
272 |
result = result_cache.get(query_id)
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
# Check if idx exists in list of children
|
278 |
-
if idx >= len(search_results):
|
279 |
-
await asyncio.sleep(0.5)
|
280 |
-
return
|
281 |
-
search_results[idx]["fields"]["full_image"] = image_data
|
282 |
result_cache.set(query_id, result)
|
283 |
return
|
284 |
|
|
|
270 |
|
271 |
async def update_full_image_cache(docid: str, query_id: str, idx: int, image_data: str):
|
272 |
result = result_cache.get(query_id)
|
273 |
+
try:
|
274 |
+
result["root"]["children"][idx]["fields"]["full_image"] = image_data
|
275 |
+
except KeyError as err:
|
276 |
+
print(f"Error updating full image cache: {err}")
|
|
|
|
|
|
|
|
|
|
|
277 |
result_cache.set(query_id, result)
|
278 |
return
|
279 |
|