detect floorplan using asyncio
This commit is contained in:
parent
68cc70bd11
commit
b1e0ed170b
3 changed files with 22 additions and 9 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import asyncio
|
||||
from dataclasses import dataclass
|
||||
import json
|
||||
import pathlib
|
||||
|
|
@ -135,13 +136,15 @@ class Listing:
|
|||
) # filter out Nones
|
||||
return max_sqm
|
||||
|
||||
def calculate_sqm_ocr(self, recalculate=True):
|
||||
async def calculate_sqm_ocr(self, recalculate=True):
|
||||
if not recalculate and self.path_floorplan_ocr_json().exists():
|
||||
return
|
||||
|
||||
objs = []
|
||||
for floorplan_path in self.list_floorplans():
|
||||
estimated_sqm, model_output = floorplan.calculate_ocr(floorplan_path)
|
||||
estimated_sqm, model_output = await asyncio.to_thread(
|
||||
floorplan.calculate_ocr, floorplan_path
|
||||
)
|
||||
objs.append(
|
||||
{
|
||||
"floorplan_path": str(floorplan_path),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue