recalculate floorplans when theres only an empty object

This commit is contained in:
Viktor Barzin 2025-05-31 23:31:06 +00:00
parent abf06be0a7
commit f9a7620bf0
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863

View file

@ -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)