From f9a7620bf0146a8dca2276867a6c39e787214b64 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sat, 31 May 2025 23:31:06 +0000 Subject: [PATCH] recalculate floorplans when theres only an empty object --- crawler/data_access.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crawler/data_access.py b/crawler/data_access.py index 007f4e8..a2cd939 100644 --- a/crawler/data_access.py +++ b/crawler/data_access.py @@ -134,10 +134,13 @@ class Listing: return max_sqm async def calculate_sqm_ocr(self, recalculate=True): - if not recalculate and self.path_floorplan_ocr_json().exists(): + objs = [] + if self.path_floorplan_ocr_json().exists(): + with open(self.path_floorplan_ocr_json()) as f: + objs = json.load(f) + if not recalculate and len(objs) > 0: return - objs = [] for floorplan_path in self.list_floorplans(): estimated_sqm, model_output = await asyncio.to_thread( floorplan.calculate_ocr, floorplan_path)