2025-05-14 21:05:59 +00:00
|
|
|
import pathlib
|
2024-03-10 18:49:39 +00:00
|
|
|
from data_access import Listing
|
|
|
|
|
from tqdm import tqdm
|
|
|
|
|
|
|
|
|
|
|
2025-05-14 21:05:59 +00:00
|
|
|
def detect_floorplan(listing_paths: list[str]):
|
|
|
|
|
listings = Listing.get_all_listings(listing_paths)
|
2025-05-11 19:06:08 +00:00
|
|
|
|
|
|
|
|
for listing in tqdm(listings):
|
|
|
|
|
tqdm.write(str(listing.identifier))
|
|
|
|
|
# listing.calculate_sqm_model() # using google/deplot model. Too slow, rather use tesseract
|
|
|
|
|
listing.calculate_sqm_ocr(recalculate=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2025-05-14 21:05:59 +00:00
|
|
|
listing_paths = sorted(list(pathlib.Path("data/rs").glob("*/listing.json")))
|
|
|
|
|
detect_floorplan(listing_paths)
|
2025-05-11 19:06:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|